#!/bin/bash
#  goC :  runs the client
#
#

#Usage: ./client V1.7): [Server IP] [Server Port] [Message Size (bytes)] [# of iterations] [Debug Flag (default : 129)]   
#		[mode 0 ECHO MODE] [iteration delay (usecs)] 
#		[mode 1 CBR MODE ] [target send rate (bps)] 
#		[mode 2 WINDOW MODE] [max Window (number packets), 0 implies infinite size] 


rm -rf Client.dat

myServer="localhost"
myPort="5000"
myMsgSize="1000"
myDebugFlag="130"
myMaxW="100"
myTargetSentRate="2000000"
myIterationDelay="1000000"

//Param1
myIterations="10"
//Param2
myMode="2"
//Param3
myParam3="100"

if [ $# -eq 1 ]; then
  myIterations="$1"
fi

if [ $# -eq 2 ]; then
  myMode="$2"
fi

if [ $# -eq 3 ]; then
  myParam3="$3"
fi

./client $myServer $myPort $myMsgSize $myIterations $myDebugFlag $myMode $myParam3 > tmpC.out


echo " key decisionMade values:   " 
echo "     NEXT_EXPECTED_ACK_EVENT 1 "
echo "     NEW_ACK_EVENT 2 "
echo "     DUPLICATE_ACK_EVENT 3"
echo "     UNEXPECTED_ACK_EVENT 4 "
echo "     TIMEOUT_EVENT  5 "
echo "     ERROR_EVENT 6 "
echo "     OLD_ACK_ERROR_EVENT 7"
echo "     SENT_MSG 10 "

echo " "
echo " information at time of an ACK arrival, Client.dat  "
echo " "
echo "Timestamp   mode, client ip:port  "
echo "             RxSeqNumber, decisionMade, curRTT, cwnd, currentWindow, largestSeqSent "
echo "                      ,leftEdge, rightEdge, snd_next"
echo "                          lastMonitorThroughputSample, lastMonitorLossRateSample, lastMonitorRTTSample" 
echo " "

cat Client.dat



