oga's tools
Revision | c1b4f4a00f8a386d61097aafc96e21c207ca9bc0 (tree) |
---|---|
Time | 2016-01-19 06:13:09 |
Author | oga <hyperoga@gmai...> |
Commiter | oga |
sutdown socket
@@ -72,10 +72,10 @@ char *b[]; | ||
72 | 72 | |
73 | 73 | for (i = 1; i<a; i++) { |
74 | 74 | if (!strncmp(b[i],"-h",2)) { |
75 | - printf("usage : netpf_send { -s | <hostname> } [-p <port(%d)>] [-c <send_size(KB)>\n", port); | |
75 | + printf("usage : netpf_send { -s | <hostname> } [-p <port(%d)>] [-c <send_size(MB)>\n", port); | |
76 | 76 | printf(" -s : start as netpf server\n"); |
77 | 77 | printf(" hostnames : netpf server name.(start as netpf client)\n"); |
78 | - printf(" -c size : test data size(MB) default:%dMB\n", SEND_SIZE); | |
78 | + printf(" -c size : test data size(MB) default:%dMB\n", SEND_SIZE/1024/1024); | |
79 | 79 | printf(" -p port : test port\n"); |
80 | 80 | exit(1); |
81 | 81 | } |
@@ -184,6 +184,7 @@ char *b[]; | ||
184 | 184 | //PUT_DATA(newsockfd, buf, SEND_SIZE); |
185 | 185 | } |
186 | 186 | printf("chile pid=%d exit!\n",getpid()); |
187 | + shutdown (newsockfd, SHUT_RDWR); | |
187 | 188 | close(newsockfd); |
188 | 189 | #ifndef DOS |
189 | 190 | exit(0); |
@@ -242,7 +243,7 @@ char *b[]; | ||
242 | 243 | //printf("## recv %d MB start\n",SEND_SIZE/1024/1024); |
243 | 244 | //GET_DATA(sockfd, buf, SEND_SIZE); |
244 | 245 | } |
245 | - //shutdown (sockfd, SHUT_RDWR); | |
246 | + shutdown (sockfd, SHUT_RDWR); | |
246 | 247 | close(sockfd); |
247 | 248 | |
248 | 249 | } |
@@ -281,10 +282,10 @@ void PUT_DATA(int sockfd, char *buf, int sz) | ||
281 | 282 | if (diff <0 ) diff = -diff; |
282 | 283 | dprintf("Send end usec : %u\n",wk2); |
283 | 284 | dprintf(" diff usec : %u\n",diff); |
284 | - printf("Send Size = %d time = %.6fsec perf = %dKB/sec\n", | |
285 | + printf("Send Size = %d time = %.3fsec perf = %.3MB/sec\n", | |
285 | 286 | all, |
286 | 287 | (float)diff/1000000, |
287 | - (diff/1000 == 0)?999999:all/(diff/1000)); /* V1.02-C */ | |
288 | + (diff/1000 == 0)?999999:(float)all/diff); /* V1.02-C */ | |
288 | 289 | } |
289 | 290 | |
290 | 291 | /* |
@@ -323,10 +324,10 @@ void GET_DATA(int sockfd, char *buf, int sz) | ||
323 | 324 | if (diff <0 ) diff = -diff; |
324 | 325 | dprintf("Recv end usec : %u\n",wk2); |
325 | 326 | dprintf(" diff usec : %u\n",diff); |
326 | - printf("Recv Size = %d time = %.6fsec perf = %dKB/sec\n", | |
327 | + printf("Recv Size = %d time = %.3fsec perf = %.3fMB/sec\n", | |
327 | 328 | all, |
328 | 329 | (float)diff/1000000, |
329 | - all/(diff/1000)); | |
330 | + (float)all/diff); | |
330 | 331 | } |
331 | 332 | |
332 | 333 | void reapchild() |