[zeromq-dev] C# socket_close Syntax

gonzalo diethelm gdiethelm at dcv.cl
Mon Nov 7 18:18:30 CET 2011

> > as far as I understand majority of the language with GC leave the
> > closing to GC. Otherwise this would cause annoying issues where the
> > object for the socket is valid but the underlying socket is invalid.
> > There should be no need for explicit close as usually object going out
> > of scope closes the socket.
> It would be more appropriate if the binding developers explain why they've
> added the function, however, my guess is that it's used to close the socket
> immediately, as opposed to leaving it to GC to clean it at some later time.
> Think of, for exmaple, bound ports. If you close the socket you want the port
> to be available for new sockets immediately rather than lingering on.

This is exactly why. Sometimes you cannot wait until GC triggers and must close your sockets before that happens.

Gonzalo Diethelm
DCV Chile

More information about the zeromq-dev mailing list