diff options
| -rw-r--r-- | demo/async/client.c | 7 | ||||
| -rw-r--r-- | demo/async/server.c | 11 | ||||
| -rw-r--r-- | demo/raw/raw.c | 12 |
3 files changed, 20 insertions, 10 deletions
diff --git a/demo/async/client.c b/demo/async/client.c index bf9389a0..18622089 100644 --- a/demo/async/client.c +++ b/demo/async/client.c @@ -1,4 +1,4 @@ -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitoar.com> // // This software is supplied under the terms of the MIT License, a @@ -26,7 +26,6 @@ #include <time.h> #include <nng/nng.h> -#include <nng/protocol/reqrep0/req.h> #include <nng/supplemental/util/platform.h> void @@ -49,6 +48,10 @@ client(const char *url, const char *msecstr) msec = atoi(msecstr); + if ((rv = nng_init(NULL)) != 0) { + fatal("nng_init", rv); + } + if ((rv = nng_req0_open(&sock)) != 0) { fatal("nng_req0_open", rv); } diff --git a/demo/async/server.c b/demo/async/server.c index 528926e6..b8a87a7e 100644 --- a/demo/async/server.c +++ b/demo/async/server.c @@ -1,4 +1,4 @@ -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitoar.com> // // This software is supplied under the terms of the MIT License, a @@ -33,8 +33,6 @@ #include <time.h> #include <nng/nng.h> -#include <nng/protocol/reqrep0/rep.h> -#include <nng/supplemental/util/platform.h> // Parallel is the maximum number of outstanding requests we can handle. // This is *NOT* the number of threads in use, but instead represents @@ -68,7 +66,7 @@ void server_cb(void *arg) { struct work *work = arg; - nng_msg * msg; + nng_msg *msg; int rv; uint32_t when; @@ -141,6 +139,11 @@ server(const char *url) int rv; int i; + rv = nng_init(NULL); + if (rv != 0) { + fatal("nng_init", rv); + } + /* Create the socket. */ rv = nng_rep0_open(&sock); if (rv != 0) { diff --git a/demo/raw/raw.c b/demo/raw/raw.c index 06f69143..3cb02169 100644 --- a/demo/raw/raw.c +++ b/demo/raw/raw.c @@ -1,4 +1,4 @@ -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitoar.com> // // This software is supplied under the terms of the MIT License, a @@ -30,9 +30,6 @@ #include <time.h> #include <nng/nng.h> -#include <nng/protocol/reqrep0/rep.h> -#include <nng/protocol/reqrep0/req.h> -#include <nng/supplemental/util/platform.h> // Parallel is the maximum number of outstanding requests we can handle. // This is *NOT* the number of threads in use, but instead represents @@ -134,6 +131,10 @@ server(const char *url) int rv; int i; + if ((rv = nng_init(NULL)) != 0) { + fatal("nng_init", rv); + } + /* Create the socket. */ rv = nng_rep0_open_raw(&sock); if (rv != 0) { @@ -170,6 +171,9 @@ client(const char *url, const char *msecstr) msec = atoi(msecstr) * 1000; + if ((rv = nng_init(NULL)) != 0) { + fatal("nng_init", rv); + } if ((rv = nng_req0_open(&sock)) != 0) { fatal("nng_req0_open", rv); } |
