From b63ce299ddacea2ad487dc635926ed52ff422c20 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期一, 03 八月 2020 11:40:17 +0800
Subject: [PATCH] add timeout nowait

---
 test_socket/dgram_mod_bus.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/test_socket/dgram_mod_bus.c b/test_socket/dgram_mod_bus.c
index 70f09c4..472ad46 100644
--- a/test_socket/dgram_mod_bus.c
+++ b/test_socket/dgram_mod_bus.c
@@ -55,15 +55,24 @@
     if(strcmp(action, "sub") == 0) {
       printf("Please input topic!\n");
       scanf("%s", topic);
-      dgram_mod_sub(socket, topic, strlen(topic),  port);
-      printf("Sub success!\n");
+      if (dgram_mod_sub(socket, topic, strlen(topic),  port) == 0) {
+         printf("Sub success!\n");
+      } else {
+        printf("Sub failture!\n");
+        exit(0);
+      }
+     
     }
     else if(strcmp(action, "pub") == 0) {
       // printf("%s %s %s\n", action, topic, content);
       printf("Please input topic and content\n");
       scanf("%s %s", topic, content);
-      dgram_mod_pub(socket, topic, strlen(topic)+1, content, strlen(content)+1,  port);
-      printf("Pub success!\n");
+      if(dgram_mod_pub(socket, topic, strlen(topic)+1, content, strlen(content)+1,  port) == 0){
+        printf("Pub success!\n");
+      } else {
+        printf("Pub failture!\n");
+      }
+      
     } else if(strcmp(action, "quit") == 0) {
       break;
     } else {

--
Gitblit v1.8.0