Parallel task worker in C++

//
// Task worker in C++
// Connects PULL socket to tcp://localhost:5557
// Collects workloads from ventilator via that socket
// Connects PUSH socket to tcp://localhost:5558
// Sends results to sink via that socket
//
// Olivier Chamoux <moc.puorgselaht.rf|xuomahc.reivilo#moc.puorgselaht.rf|xuomahc.reivilo>
//
#include "zhelpers.hpp"

int main (int argc, char *argv[])
{
zmq::context_t context(1);

// Socket to receive messages on
zmq::socket_t receiver(context, ZMQ_PULL);
receiver.connect("tcp://localhost:5557");

// Socket to send messages to
zmq::socket_t sender(context, ZMQ_PUSH);
sender.connect("tcp://localhost:5558");

// Process tasks forever
while (1) {

zmq::message_t message;
int workload; // Workload in msecs

receiver.recv(&message);

std::istringstream iss(static_cast<char*>(message.data()));
iss >> workload;

// Do the work
s_sleep(workload);

// Send results to sink
message.rebuild();
sender.send(message);

// Simple progress indicator for the viewer
std::cout << "." << std::flush;
}
return 0;
}