git-svn-id: svn://elaine/murooma/trunk@129 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-08-03 08:37:21 +00:00
parent 4f5cbb5e25
commit 06a7909b1a
5 changed files with 106 additions and 87 deletions

View file

@ -9,17 +9,18 @@
#include "utils.h"
zmq::socket_t* client;
zmq::socket_t* client2;
void receiver(zmq::socket_t* client)
{
while (true)
{
std::string address = s_recv (*client);
// std::string address = s_recv (*client);
// receiving and discarding'empty' message
// s_recv (*client);
// receiving and discarding 'ready' message
std::string msg = s_recv (*client);
std::cout << "msg from " << address << ": " << msg << "\n";
std::cout << "msg from " << msg << "\n";
}
}
@ -33,12 +34,12 @@ void send(const std::string& address, const std::string& cmd)
int main () {
zmq::context_t context(2);
client = new zmq::socket_t(context, ZMQ_ROUTER);
zmq::context_t context(1);
client = new zmq::socket_t(context, ZMQ_PAIR);//ZMQ_ROUTER);
client->bind("tcp://0.0.0.0:123459");
std::thread receiveThread(receiver, client);
receiveThread.join();
while (true)
{
std::string address;