#!/bin/sh
#
# iphb test script
#
#  Arg 1: (optional) server IP address, default 192.168.2.14
#
#  Arg 2 (optional): TCP keepalive timer (secs); default 30
#
#




SERVER=192.168.2.14

if [ "$1_" != "_" ]; then
  SERVER=$1
fi


echo "Start 3 nc processes in the server at $SERVER:"
echo "   nc -l -p 8080 &"
echo "   nc -l -p 8081 &"
echo "   nc -l -p 8082 &"


if [ "$2_" != "_" ]; then
  KATIMER=$2
else
  KATIMER=30
fi

echo "Starting test clients..."
hbtest $SERVER 8080 $KATIMER &
sleep 5
hbtest $SERVER 8081 $KATIMER &
sleep 5
hbtest $SERVER 8082 $KATIMER &


echo ""
echo ""
echo ""
echo "Press Enter to stop"
echo ""
echo ""
echo ""

read ENTER
killall hbtest
