aboutsummaryrefslogtreecommitdiff
path: root/demo/raw
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-01 15:38:19 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-01 15:40:54 -0800
commit46117f86d47da376b37c6fb4d72ee202de599c9b (patch)
tree0eae4d42b2fce56163cd5fa1c361038567c46371 /demo/raw
parent6cd521d5e68318ab3a93cb0e9cd4ee793576a643 (diff)
downloadnng-46117f86d47da376b37c6fb4d72ee202de599c9b.tar.gz
nng-46117f86d47da376b37c6fb4d72ee202de599c9b.tar.bz2
nng-46117f86d47da376b37c6fb4d72ee202de599c9b.zip
demos: raw and async demos should use nng_init
Diffstat (limited to 'demo/raw')
-rw-r--r--demo/raw/raw.c12
1 files changed, 8 insertions, 4 deletions
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);
}