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

using namespace std;

#include <zmq.hpp>

using namespace zmq;

const string TOPIC = "1234";

int main(void)
{
    context_t ctx;
    socket_t s(ctx, socket_type::pub);
    s.bind("tcp://*:10003");
    int count = 0;
    for(;;)
    {
        count++;
        stringstream temp;
        temp << TOPIC << " C++ server (" << count << ")";
        string respmsg = temp.str();
        s.send(buffer(respmsg), send_flags::none);
        zmq_sleep(3);
    }
    return 0;
}
