Pub-Sub envelope subscriber in C

// Pubsub envelope subscriber
#include "zhelpers.h"

int main (void)
// Prepare our context and subscriber
void *context = zmq_ctx_new ();
void *subscriber = zmq_socket (context, ZMQ_SUB);
zmq_connect (subscriber, "tcp://localhost:5563");
zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE, "B", 1);

while (true) {
// Read envelope with address
char *address = s_recv (subscriber);
// Read message contents
char *contents = s_recv (subscriber);
printf ("[%s] %s\n", address, contents);
free (address);
free (contents);
// We never get here but clean up anyhow
zmq_close (subscriber);
zmq_ctx_destroy (context);
return 0;