/* countClient - Connect repeatedly to the count server. */ #include "common.h" #include #include #include #include "internet.h" #include "linefile.h" #include "hash.h" #include "options.h" #include "net.h" void usage() /* Explain usage and exit. */ { errAbort( "countClient - Connect repeatedly to the count server\n" "usage:\n" " countClient host port count\n" "options:\n" " -tcp\n" " -udp\n" ); } bits32 timeDiff(struct timeval *past, struct timeval *now) /* Return different between now and past. */ { bits32 diff = now->tv_sec - past->tv_sec; diff *= 1000000; diff += now->tv_usec - past->tv_usec; return diff; } struct countMessage /* What to transmit. */ { bits32 time; bits32 echoTime; bits32 count; bits32 message; // char payload[512-16]; }; void tcpCountClient(char *host, char *portName, char *countString) /* countClient - Connect repeatedly to the count server. */ { int i, size, count = atoi(countString); int socket; struct countMessage sendMessage, receiveMessage; struct timeval startTime, tv; struct sockaddr_in outAddress, inAddress; gettimeofday(&startTime, NULL); for (i=0; i