/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#include <stdio.h>
#include <string.h>

#include <zmq.h>

#define TOPIC "1234"

int main(void)
{
    void *ctx;
    void *s;
    char respmsg[10000];
    int count;
    ctx = zmq_ctx_new();
    s = zmq_socket(ctx, ZMQ_PUB);
    zmq_bind(s, "tcp://*:10002");
    count = 0;
    for(;;)
    {
        count++;
        sprintf(respmsg, "%s C (low) server (%d)", TOPIC, count);
        zmq_send(s, respmsg, strlen(respmsg), 0);
        zmq_sleep(3);
    }
    return 0;
}
