| | |
| | | #include "net_mod_socket_wrapper.h" |
| | | #include "bus_server_socket_wrapper.h" |
| | | |
| | | #include "shm_mm_wraper.h" |
| | | #include "shm_mm_wrapper.h" |
| | | #include "usg_common.h" |
| | | #include <getopt.h> |
| | | |
| | |
| | | |
| | | if (fgets(content, MAXLINE, stdin) != NULL) { |
| | | // 收到消息的节点即使没有对应的信息, 也要回复一个表示无的消息,否则会一直等待 |
| | | n = net_mod_socket_sendandrecv(client, node_arr, node_arr_size, content, strlen(content), &recv_arr, &recv_arr_size); |
| | | // n = net_mod_socket_sendandrecv(client, node_arr, node_arr_size, content, strlen(content), &recv_arr, &recv_arr_size); |
| | | n = net_mod_socket_sendandrecv_timeout(client, node_arr, node_arr_size, content, strlen(content), &recv_arr, &recv_arr_size, 1000); |
| | | printf(" %d nodes reply\n", n); |
| | | for(i=0; i<recv_arr_size; i++) { |
| | | printf("host:%s, port: %d, key:%d, content: %s\n", |
| | |
| | | net_mod_recv_msg_t *recv_arr; |
| | | int total = 0; |
| | | |
| | | |
| | | void *client = net_mod_socket_open(); |
| | | net_node_t *node_arr; |
| | | int node_arr_size = parse_node_list(targ->nodelist, &node_arr); |
| | | |
| | |
| | | total += n; |
| | | } |
| | | fclose(fp); |
| | | |
| | | net_mod_socket_close(client); |
| | | return (void *)total; |
| | | } |
| | | |
| | |
| | | struct timeval start, end; |
| | | long total = 0; |
| | | |
| | | client = net_mod_socket_open(); |
| | | |
| | | printf("开始测试...\n"); |
| | | gettimeofday(&start, NULL); |
| | | for (i = 0; i < processors; i++) { |
| | |
| | | long diffusec = difftime - diffsec*1000000; |
| | | fprintf(stderr,"发送数目: %ld, 用时: (%ld sec %ld usec), 平均: %f\n", total, diffsec, diffusec, difftime/total ); |
| | | // fflush(stdout); |
| | | net_mod_socket_close(client); |
| | | |
| | | } |
| | | |
| | | |