From 6de74d5e60a9a5ecd417a5473a3b567e51ca2de8 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期一, 25 一月 2021 15:14:23 +0800
Subject: [PATCH] update

---
 test_socket/bus_test.cpp |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/test_socket/bus_test.cpp b/test_socket/bus_test.cpp
index f84ad52..a186d7f 100644
--- a/test_socket/bus_test.cpp
+++ b/test_socket/bus_test.cpp
@@ -23,7 +23,7 @@
 }
 
 
-void *run_recv2(void *skptr) {
+void *run_recv(void *skptr) {
   pthread_detach(pthread_self());
   void *recvbuf;
   int size;
@@ -35,7 +35,8 @@
   while (true) {
     printf("run_recv before\n");
 
-    rv = sk->recvfrom_timeout( &recvbuf, &size, &key, &timeout);
+    // rv = sk->recvfrom_timeout( &recvbuf, &size, &key, &timeout);
+    rv = sk->recvfrom( &recvbuf, &size, &key);
     if(rv == 0) {
       printf("鏀跺埌璁㈤槄娑堟伅:%s\n", recvbuf);
       free(recvbuf);
@@ -48,10 +49,11 @@
   
 }
 
-void *run_recv(void *skptr) {
+void *run_recv2(void *skptr) {
+  pthread_detach(pthread_self());
   while(true) {
     logger->debug("================run_recv\n");
-    sleep(1);
+    // sleep(1);
   }
 }
 
@@ -77,9 +79,10 @@
   while (true) {
     //printf("Usage: pub <topic> [content] or sub <topic>\n");
     printf("Can I help you? sub, pub, desub or quit %d\n", i++);
-    // sleep(100);
-    scanf("%s", action);
-    
+    printf("client 1\n");
+    // scanf("%s", action);
+    std::cin >> action;
+    printf("client 2\n");
     if(strcmp(action, "sub") == 0) {
       printf("Please input topic!\n");
       scanf("%s", topic);

--
Gitblit v1.8.0