Request-reply worker in C

// Hello World worker
// Connects REP socket to tcp://*:5560
// Expects "Hello" from client, replies with "World"
#include "zhelpers.h"

int main (void)
void *context = zmq_ctx_new ();

// Socket to talk to clients
void *responder = zmq_socket (context, ZMQ_REP);
zmq_connect (responder, "tcp://localhost:5560");

while (true) {
// Wait for next request from client
char *string = s_recv (responder);
printf ("Received request: [%s]\n", string);
free (string);

// Do some 'work'
sleep (1);

// Send reply back to client
s_send (responder, "World");
// We never get here but clean up anyhow
zmq_close (responder);
zmq_ctx_destroy (context);
return 0;