From f89a58860e4e3c76ef3c2e85d47ff38eeaaabb55 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sat, 15 Jul 2023 08:38:33 +0200 Subject: Minor changes --- src/publisher.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/publisher.c (limited to 'src/publisher.c') diff --git a/src/publisher.c b/src/publisher.c new file mode 100644 index 0000000..134d678 --- /dev/null +++ b/src/publisher.c @@ -0,0 +1,27 @@ +// Weather update server +// Binds PUB socket to tcp://*:5556 +// Publishes random weather updates + +#include +#include +#include + +#include "utils.h" + +int main (void) +{ + // Prepare our context and publisher + void *context = zmq_ctx_new (); + void *publisher = zmq_socket (context, ZMQ_PUB); + int rc = zmq_bind (publisher, "tcp://*:"STRINGIFY(PUBLISHER_PORT)); + assert (rc == 0); + + // Initialize random number generator + while (1) { + zmq_send (publisher, "Hello World", 5, 0); + printf("AA\n"); + } + zmq_close (publisher); + zmq_ctx_destroy (context); + return 0; +} \ No newline at end of file -- cgit v1.2.3