From 73866a4c527cbdf726c5fd824526d5657d0e15ee Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期一, 15 六月 2020 19:47:13 +0800
Subject: [PATCH] update

---
 test/nng/pubsub.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/nng/pubsub.c b/test/nng/pubsub.c
index 794cd6c..c45476b 100644
--- a/test/nng/pubsub.c
+++ b/test/nng/pubsub.c
@@ -32,6 +32,7 @@
 {
         nng_socket sock;
         int rv;
+        char buf[1024];
 
         if ((rv = nng_pub0_open(&sock)) != 0) {
                 fatal("nng_pub0_open", rv);
@@ -41,8 +42,9 @@
         }
         for (;;) {
                 char *d = date();
+                snprintf(buf, 1024, "time:%s", d);
                 printf("SERVER: PUBLISHING DATE %s\n", d);
-                if ((rv = nng_send(sock, d, strlen(d) + 1, 0)) != 0) {
+                if ((rv = nng_send(sock, buf, strlen(buf) + 1, 0)) != 0) {
                         fatal("nng_send", rv);
                 }
                 sleep(1);
@@ -60,7 +62,7 @@
         }
 
         // subscribe to everything (empty means all topics)
-        if ((rv = nng_setopt(sock, NNG_OPT_SUB_SUBSCRIBE, "", 0)) != 0) {
+        if ((rv = nng_setopt(sock, NNG_OPT_SUB_SUBSCRIBE, "nnnnnnnnn", 0)) != 0) {
                 fatal("nng_setopt", rv);
         }
         if ((rv = nng_dial(sock, url, NULL, 0)) != 0) {

--
Gitblit v1.8.0