Thank you for your quick reply. Unfortunately adding "server.Monitor(null);" before "server.Close();" doesn't work because it throw an ArgumentNullException... I'm using versions 3.3.0.11 or 3.3.0.12.rc1
If it's a bug, should I report it on github or has it already been reported? Should I propose my example as test as well? ----- Doron Somech <[email protected]> a écrit : > It is a bug. Anyway you can work around it by calling server.Monitor with > null as the endpoint before closing the server. > > > On Mon, Mar 23, 2015 at 6:48 PM, Leonard Michelet < > [email protected]> wrote: > > > Hello everyone, I'm having problem using Monitor with NetMQ. Please tell > > me if there is a dedicated place to ask about NetMQ, or possibly report bug. > > Here's what I do : > > 1) I create and bind a DEALER socket, associate a monitor to it and start > > monitoring it. > > 2) Then I Unbind the socket, stop monitoring, dispose everything but the > > NetMQContext. > > 3) Finally, I want to start again 1) but I receive a NetMQException > > because the inproc socket created by the DEALER socket to send event to its > > monitor is still alive. > > > > Next is a simple code to see my problem : > > > > using System; > > using System.Threading; > > using NetMQ; > > using System.Threading.Tasks; > > using NetMQ.Monitoring; > > using NetMQ.zmq; > > > > namespace Server > > { > > class ServerProg > > { > > static void CreateServerSocket(NetMQContext ctx) > > { > > try > > { > > using (var server = ctx.CreateDealerSocket()) > > { > > var monitor = new NetMQMonitor(ctx, server, > > "inproc://*:4556.monitor", > > SocketEvent.Connected | > > SocketEvent.Disconnected); > > Task monitorTask = > > Task.Factory.StartNew(monitor.Start); > > server.Bind("tcp://*:4556"); > > Thread.Sleep(500); > > server.Unbind("tcp://*:4556"); > > monitor.Stop(); > > monitor.Dispose(); > > server.Close(); > > server.Dispose(); > > } > > } > > catch (NetMQException e) > > { > > Console.Out.WriteLine("Exception: " + e); > > throw; > > } > > } > > > > static void Main(string[] args) > > { > > using (NetMQContext ctx = NetMQContext.Create()) > > { > > CreateServerSocket(ctx); > > CreateServerSocket(ctx); > > } > > } > > } > > } > > _______________________________________________ > > zeromq-dev mailing list > > [email protected] > > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
