From 203df24a403a8c0cd8e93d0f33eaf10de2788969 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期四, 06 八月 2020 10:22:46 +0800
Subject: [PATCH] add desub

---
 test_socket/dgram_mod_bus.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/test_socket/dgram_mod_bus.c b/test_socket/dgram_mod_bus.c
index 472ad46..5a549bc 100644
--- a/test_socket/dgram_mod_bus.c
+++ b/test_socket/dgram_mod_bus.c
@@ -49,7 +49,7 @@
   long i = 0;
   while (true) {
     //printf("Usage: pub <topic> [content] or sub <topic>\n");
-    printf("Can I help you? sub, pub or quit\n");
+    printf("Can I help you? sub, pub, desub or quit\n");
     scanf("%s",action);
     
     if(strcmp(action, "sub") == 0) {
@@ -59,6 +59,16 @@
          printf("Sub success!\n");
       } else {
         printf("Sub failture!\n");
+        exit(0);
+      }
+     
+    } else if(strcmp(action, "desub") == 0) {
+      printf("Please input topic!\n");
+      scanf("%s", topic);
+      if (dgram_mod_desub(socket, topic, strlen(topic),  port) == 0) {
+         printf("Desub success!\n");
+      } else {
+        printf("Desub failture!\n");
         exit(0);
       }
      
@@ -76,7 +86,7 @@
     } else if(strcmp(action, "quit") == 0) {
       break;
     } else {
-      printf("error input\n");
+      printf("error input argument\n");
       continue;
     }
    

--
Gitblit v1.8.0