3

Let me explain how I got this exception from such a simple code, I've used a trading program called cAlgo where I tried to run a NetMQ server, apparently while stopping it, it doesn't close correctly, leaving the port unusable until I restart my computer.

I would like some assistance recovering this port and making it usable again, I've tried to clean it without success, I'm starting with ZeroMQ so I'm not skilled on it.

Thanks you, attached is the exception (With an inner SocketException, Only one usage of each socket address (protocol/network address/port).

enter image description here

void Main()
{
    using (var server = new ResponseSocket("@tcp://localhost:5555")) // bind
    using (var client = new RequestSocket(">tcp://localhost:5555"))  // connect
    {
        // Send a message from the client socket
        client.SendFrame("Hello");

        // Receive the message from the server socket
        string m1 = server.ReceiveFrameString();
        Console.WriteLine("From Client: {0}", m1);

        // Send a response back from the server
        server.SendFrame("Hi Back");

        // Receive the response from the client socket
        string m2 = client.ReceiveFrameString();
        Console.WriteLine("From Server: {0}", m2);
    }
}
Xavi
  • 124
  • 2
  • 9
  • Just an Update, closing the cAlgo Application will release the port, however that's not the solution I'm looking for. – Xavi May 02 '17 at 05:30

1 Answers1

1

I resolved it by creating a global ResponseSocket and closing the socket before the instance inside my application stopped.

Xavi
  • 124
  • 2
  • 9