zeromq/clrzmq

Problem with Receive with timeout on Mono

NBRizzoli opened this issue · 0 comments

Hi,
i've got a strange error using a Request type socket on Mono : when i use a Receive specyfing a timeout the following exception occours :

Unhandled Exception: ZeroMQ.ZmqSocketException: No such file or directory
at ZeroMQ.ZmqSocket.Receive (System.Byte[] buffer, SocketFlags flags, System.Int32& size) [0x00000] in :0
at ZeroMQ.ExecuteExtensions.WithTimeout[Byte[],SocketFlags,Int32,Byte[]](ZeroMQ.ZmqSocket socket, ZeroMQ.ThirdParamOut`4 method, System.Byte[] arg1, SocketFlags arg2, System.Int32& arg3, TimeSpan timeout) [0x00000] in :0
at ZeroMQ.ZmqSocket.Receive (System.Byte[] buffer, TimeSpan timeout, System.Int32& size) [0x00000] in :0
at ZeroMQ.SendReceiveExtensions.Receive (ZeroMQ.ZmqSocket socket, System.Text.Encoding encoding, TimeSpan timeout) [0x00000] in :0
at TestClrzmqMono.Program.Main (System.String[] args) [0x00000] in :0

The simple piece of code that give me the issue :

     using (var context = ZmqContext.Create())
     {
        using (ZmqSocket requester = context.CreateSocket(SocketType.REQ))
        {
           requester.Connect("tcp://localhost:8888");

           const string requestMessage = "Hello";
           const int requestsToSend = 10;

           for (int requestNumber = 0; requestNumber < requestsToSend; requestNumber++)
           {
              Console.WriteLine("Sending request {0}…", requestNumber);
              requester.Send(requestMessage, Encoding.Unicode);

              TimeSpan ts = new TimeSpan(0, 0, 1);
              string reply = requester.Receive(Encoding.Unicode, ts);
              Console.WriteLine("Received reply {0}: {1}", requestNumber, reply);
           }
        }
     }

On windows it works fine.
I hope someone can help me with this.

PS : with a bit of debug i've found that the exception is thrown by the following line of code :
" receiveResult = method(arg1, arg2, out arg3); "
in file ExecuteExtensions.cs, line 81.
But i can't understand why this line of code can throw a "No such file or directory"....