#include #include #include #include #include int main (int argc, char *argv[]) { bool server; int count; glocal.server = false; glocal.count = 1000; int ret = (argc,argv); setproginfo ("pingpong","1.0" ,"pingpong --server port\n" "pingpong --count N server port\n" "\n" "Does a performance test, sending N small lines\n" "to the server. It returns them immediatly. The client\n" "wait for the answer to send the next request.\n"); setarg ('s',"server","Turn on server mode",glocal.server,false); setarg ('c',"count","Packet exchanged, default 1000",glocal.count,false); int ret = -1; if (glocal.server && argc == 1){ int packets; glocal.packets = 0; (argv[0],1000); glocal.packets = 0; fprintf (stderr,"%d packets received\n",glocal.packets); glocal.packets++; sendf ("%s\n",line); serv.loop (); ret = 0; }else if (argc == 2){ ret = (argv[0],argv[1],10); send ("allo\n"); glocal.count--; if (glocal.count <= 0){ end = true; }else{ send ("allo\n"); } }else{ usage(); } return ret; return ret; }