I have the need to communicate two applications , one server in C ++ and one c # client .
I'm trying to use 0MQ on the server and the binder C # NetMq . I can make the connect from the client and to send a message from the client to the server but not the other . The client waits and does not receive the sending by the server.
Some examples?
Server:
try
{
zmq::context_t context (1);
zmq::socket_t socket(context, ZMQ_PAIR);
socket.bind ("tcp://*:5556");
zmq::message_t request;
// just once
for(;;)
{
zmq::message_t request;
socket.recv (&request);
std::cout << "Received" << std::endl;
std::string msg_str(static_cast<char*>(request.data()), request.size());
std::cout << msg_str << std::endl;
zmq::message_t reply (5);
memcpy (reply.data (), "Hello", 5);
boost::this_thread::sleep_for(boost::chrono::milliseconds(2000));
socket.send(reply);
}
Client:
using (var requestSocket = new RequestSocket(">tcp://192.168.70.150:5556"))
{
Console.WriteLine("requestSocket : Sending 'Hello'");
requestSocket.SendFrame("Hello");
var message = requestSocket.ReceiveFrameString();
Console.WriteLine(message);
}
This is a trivial example of sending and response that I'm trying to implement and then expand .