From 3a89a77e79407d0d638ddf983ee580410cf807c5 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期二, 04 八月 2020 15:56:12 +0800
Subject: [PATCH] fix sendto

---
 test_socket/dgram_mod_req_rep.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/test_socket/dgram_mod_req_rep.c b/test_socket/dgram_mod_req_rep.c
index 119b497..4ec451f 100644
--- a/test_socket/dgram_mod_req_rep.c
+++ b/test_socket/dgram_mod_req_rep.c
@@ -19,7 +19,7 @@
 
 }Targ;
 
-LockFreeQueue<task_t, DM_Allocator> task_queue(100);
+LockFreeQueue<task_t, DM_Allocator> task_queue(128);
 
 
 void *worker(void *socket) {
@@ -44,7 +44,7 @@
 }
 
 void server(int port) {
-  void *socket = dgram_mod_open_socket(REQ_REP);
+  void *socket = dgram_mod_open_socket();
   dgram_mod_bind(socket, port);
  	initThreadPool(socket);
 
@@ -58,7 +58,7 @@
 }
 
 void client(int port) {
-  void *socket = dgram_mod_open_socket(REQ_REP);
+  void *socket = dgram_mod_open_socket();
   int size;
   void *recvbuf;
   char sendbuf[512];
@@ -80,10 +80,10 @@
   char sendbuf[512];
   int scale = 100000;
   int i;
-  void *socket = dgram_mod_open_socket(REQ_REP);
+  void *socket = dgram_mod_open_socket();
 	
 	char filename[512];
-	sprintf(filename, "test%d.txt", targ->id);
+	sprintf(filename, "test%d.tmp", targ->id);
 	FILE *fp = NULL;
 	fp = fopen(filename, "w+");
 
@@ -146,11 +146,13 @@
   port = atoi(argv[2]);
 
   if (strcmp("server", argv[1]) == 0) {
-    server(port);
+    int temp = shm_alloc_key();
+    printf("tmp=%d\n", temp);
+    server(temp);
   }
 
   if (strcmp("client", argv[1]) == 0)
-    startClients(port);
+    client(port);
 
   
   return 0;

--
Gitblit v1.8.0