test_socket/dgram_mod_req_rep.c
@@ -72,6 +72,20 @@ dgram_mod_close_socket(socket); } void client2(int port) { void *socket = dgram_mod_open_socket(); int size; void *recvbuf; char sendbuf[512]; while (true) { sprintf(sendbuf, "hello\n" ); dgram_mod_sendandrecv(socket, sendbuf, strlen(sendbuf) + 1, port, &recvbuf, &size); printf("reply: %s\n", (char *)recvbuf); free(recvbuf); } dgram_mod_close_socket(socket); } void *runclient(void *arg) { @@ -152,7 +166,7 @@ } if (strcmp("client", argv[1]) == 0) client(port); client2(port); return 0;