Wrote client-server data transfer using ØMQ. Judging by the description, if ØMQ is disconnected, it should reconnect itself. If I manually disconnect the server part of the program, it reconnects, if I manually disconnect the network card, it reconnects. But if you pull out the power cord for a long time, then when you connect it back, the client side stops at "Waiting for an answer ...", server part at "Waiting for a client". How to make it connect with this disconnect?
Client code:
int i = 0; var context = new ZContext(); using (var client = new ZSocket(context, ZSocketType.REQ)) { client.Connect("tcp://192.168.1.13:5555"); while (true) { i++; Console.WriteLine("Отправляю"); client.Send(new ZFrame(i.ToString())); Console.WriteLine("Отправил: " + i); Thread.Sleep(1000); Console.WriteLine("Жду ответа..."); using (ZFrame reply = client.ReceiveFrame()) { Console.WriteLine(" Получил: " + reply.ReadString()); } Server code:
var context = new ZContext(); using (var responder = new ZSocket(context, ZSocketType.REP)) { responder.Bind("tcp://*:5555"); while (true) { Console.WriteLine("Жду клиента"); using (ZFrame request = responder.ReceiveFrame()) { Console.WriteLine("Получено: "+ request.ReadString()); Console.WriteLine("Отправляю ответ"); responder.Send(new ZFrame("Success")); } } } PS Found a more detailed description of the problem HERE , but I can't figure out how to solve it.