ltpSockets.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. # This script will start the socket server and then run the
  3. # sockets clients to execute the tests. If the kernel isn't
  4. # setup for multiCast server, then the other tests will continue without multiCast.
  5. # 03/28/03 mridge@us.ibm.com new tests
  6. cd `dirname $0`
  7. export LTPROOT=${PWD}
  8. export TMPBASE="/tmp"
  9. usage()
  10. {
  11. cat <<-END >&2
  12. usage: ${0##*/} [ -h hostname2 ] [ -d testdata ]
  13. defaults:
  14. hostname1=$hostname1
  15. testdata=$testdata
  16. ltproot=$LTPROOT
  17. tmpdir=$TMPBASE
  18. example: ${0##*/} -h myhostname -d "my test data to be sent"
  19. END
  20. exit
  21. }
  22. while getopts :h:d: arg
  23. do case $arg in
  24. h) hostname1=$OPTARG;;
  25. d) testdata=$OPTARG;;
  26. \?) echo "************** Help Info: ********************"
  27. usage;;
  28. esac
  29. done
  30. if [ ! -n "$hostname1" ]; then
  31. echo "Missing the hostname! A hostname must be passed for the test."
  32. usage;
  33. exit
  34. fi
  35. if [ ! -n "$testdata" ]; then
  36. echo "Missing test data! You must pass data for the test."
  37. usage;
  38. exit
  39. fi
  40. echo "Starting UDP, TCP and Multicast tests..."
  41. echo "Starting ltpServer..."
  42. ./ltpServer $hostname1 &
  43. sleep 5
  44. echo "Starting ltpClient..."
  45. ./ltpClient $hostname1 $hostname1 $testdata
  46. sleep 1
  47. killall -9 ltpServer
  48. killall -9 ltpClient