00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <stdlib.h>
00012 #include <unistd.h>
00013 #include <time.h>
00014
00015 int main(int argc, char *argv[]) {
00016 int i;
00017 int max_iterations = 1000;
00018 struct timespec time;
00019 char tcporder[]="./tcpClient 158.42.58.141 Hello_baby";
00020 char udporder[]="./udpClient 158.42.58.141 Hello_baby";
00021 char command[60];
00022
00023 time.tv_sec = 0;
00024 time.tv_nsec = 50000;
00025
00026 if(argc == 2)
00027 max_iterations = atoi(argv[1]);
00028
00029 for(i=0; i< max_iterations; i++){
00030 sprintf( &command[0],"%s%d %s", tcporder, i, "> /dev/null");
00031 if(system(&command[0])==-1) break;
00032 sprintf( &command[0],"%s%d %s", udporder, i, "> /dev/null");
00033 if(system(&command[0])==-1) break;
00034 }
00035
00036 return 0;
00037 }