I am able to have c# (client) and python (server) talk to each other by using a simple request-reply. However, I want my web application built on c# asp.net to be stable and need more clients and servers, so I tried connecting c# and python using the Extended REQ-REP connection.
But when I run the code below, it does not do its job as a broker and outputs nothing. What am I doing wrong here?
5600 = c# client
5601 = python server
using (var frontend = new RouterSocket("@tcp://127.0.0.1:5600"))
using (var backend = new DealerSocket("@tcp://127.0.0.1:5601"))
{
// Handler for messages coming in to the frontend
frontend.ReceiveReady += (s, p) =>
{
var msg = p.Socket.ReceiveFrameString();
backend.SendFrame(msg); // Relay this message to the backend
};
// Handler for messages coming in to the backend
backend.ReceiveReady += (s, p) =>
{
var msg = p.Socket.ReceiveFrameString();
frontend.SendFrame(msg); // Relay this message to the frontend
};
using (var poller = new NetMQPoller { backend, frontend })
{
// Listen out for events on both sockets and raise events when messages come in
poller.Run();
}
}