On Thu, Sep 23, 2010 at 2:46 PM, gonzalo diethelm <[email protected]> wrote: > I believe there is no way to query what type a socket is; is this right? > > > > I could use such a function and can think of a couple of use cases. One of > them would be adding many sockets (of possibly different types) to a > collection, and then iterating over that collection and taking action on the > sockets depending on their type.
Yep, we have run into this need a couple of time. One usage case that we had is a custom device that needed to do special logic for XREP sockets with the identities. It would be great to have a function like the one proposed below. > > > I don’t think zmq_getsockopt() would be a good fit for such a functionality, > because it might convey the idea that you could also change the type with an > equivalent call to zmq_setsockopt(). Unless we want to add this capability… > (I doubt it). +1 > > > Would there be interest in adding a function that returned this information? > Something like: > > > > int zmq_socket_type(void* socket); Yep, this look dead on. I would love to see this. Cheers, Brian > > > It could return -1 on error (and maybe set errno to EINVAL), or the > appropriate socket type for the given socket. > > > > > > Gonzalo Diethelm > > > > ________________________________ > > Declaración de confidencialidad: Este Mensaje esta destinado para el uso de > la o las personas o entidades a quien ha sido dirigido y puede contener > información reservada y confidencial que no puede ser divulgada, difundida, > ni aprovechada en forma alguna. El uso no autorizado de la información > contenida en este correo podrá ser sancionado de conformidad con la ley > chilena. Si usted ha recibido este correo electrónico por error, le pedimos > eliminarlo junto con los archivos adjuntos y avisar inmediatamente al > remitente, respondiendo este mensaje. Disclosure: This Message is to be used > by the individual, individuals or entities that it is addressed to and may > include private and confidential information that may not be disclosed, made > public nor used in any way at all. Unauthorized use of the information in > this electronic mail message may be subject to the penalties set forth by > Chilean law. If you have received this electronic mail message in error, we > ask you to destroy the message and its attached file(s) and to immediately > notify the sender by answering this message. > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > -- Brian E. Granger, Ph.D. Assistant Professor of Physics Cal Poly State University, San Luis Obispo [email protected] [email protected] _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
