[zeromq-dev] Re : Re: [NetMQ] How to properly free a monitor in order to be able to recreate one?

Doron Somech somdoron at gmail.com
Tue Mar 24 09:20:44 CET 2015


Yes report it and include the example.

On Tue, Mar 24, 2015 at 10:10 AM, Leonard Michelet <
leonard.michelet at openwide.fr> wrote:

> 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 <somdoron at gmail.com> 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 <
> > leonard.michelet at openwide.fr> 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
> > > zeromq-dev at lists.zeromq.org
> > > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> > >
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150324/85d8e02a/attachment.htm>


More information about the zeromq-dev mailing list