I have RouterSocket that sends a message and then gets a reply, the problem is that the ReceiveReady fires infinitely.
Here my code:
using NetMQ;
using NetMQ.Sockets;
using System.Text;
RouterSocket router = new RouterSocket();
router.Connect("tcp://127.0.0.1:8976");
router.ReceiveReady += RouterSocket_ReceiveReady;
router.SendFrame(Encoding.ASCII.GetBytes("Hello"));
NetMQPoller poller = new NetMQPoller{router};
poller.Run();
void RouterSocket_ReceiveReady(object? sender, NetMQSocketEventArgs e)
{
var message = router.ReceiveMultipartMessage();
Console.WriteLine($"Received: {message}");
}
the line Console.WriteLine($"Received: {message}"); prints the response again and again
Unless you call Stop or StopAsync from another thread this is the intended functionality.