2023-07-14 18:49:03 +02:00
|
|
|
// Weather update server
|
|
|
|
// Binds PUB socket to tcp://*:5556
|
|
|
|
// Publishes random weather updates
|
2023-07-14 18:26:31 +02:00
|
|
|
|
2023-07-14 18:49:03 +02:00
|
|
|
#include <zmq.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <time.h>
|
2023-07-14 18:26:31 +02:00
|
|
|
|
2023-07-14 18:49:03 +02:00
|
|
|
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://*:5556");
|
|
|
|
assert (rc == 0);
|
2023-07-14 18:26:31 +02:00
|
|
|
|
2023-07-14 18:49:03 +02:00
|
|
|
// 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;
|
|
|
|
}
|