I'm using NetMQ sockets to perform client - server communications. I have a single server that listens to port 5555 and a client, that .bind()
-s to it.
Here's my code sample:
using (NetMQContext ctx = NetMQContext.Create())
{
using (var client = ctx.CreateRequestSocket())
{
client.Connect("tcp://127.0.0.1:5555");
client.SendFrame(jData);
}
}
What I would like to do is to communicate to the user if the client doesn't find any server listening to that port.
What it is actually happening is that if there is no server listening to that port then no exceptions are raised and the .sendFrame()
is called and the application crashes.
Is there any method, such as Exceptions or state code, that can inform me if the connection succeded or not?