[zeromq-dev] Access to underlying Linux socket?

Luca Boccassi luca.boccassi at gmail.com
Thu Feb 11 11:16:29 CET 2016


On 11 February 2016 at 09:32, Mark Gillott <mgillott at brocade.com> wrote:
> On Wed, 2016-02-10 at 23:33 +0000, Luca Boccassi wrote:
>> On Feb 10, 2016 20:39, "Mark Gillott" <mgillott at brocade.com> wrote:
>> >
>> > On Wed, 2016-02-10 at 20:45 +0100, Pieter Hintjens wrote:
>> > > You can't do this really, since one ZeroMQ socket can map to 0..n
>> > > system sockets.
>> > >
>> >
>> > Had a feeling that was going to be the case.
>> >
>> > > There is a new option on libzmq master that lets you pre-configure
>> a
>> > > FD and give it to ZeroMQ to use for its first pipe. (ZMQ_USE_FD).
>> > >
>> >
>> > Care to expand a bit more? Is there something (test code? source
>> module)
>> > you can point me at?
>>
>> I can point you to the guy who developed that option. He sits a few
>> meters from you in the same office and he has an awesome beard. :-)
>>
>
> Is that the Italian guy who likes to add chicken to his pizza? :-).

Still better than deep fried mars bars!

>> > > A custom hook to configure new sockets is a nice idea.
>> > >
>> >
>> > So you register a hook with a newly created socket and you would get
>> a
>> > callback just prior to any bind/connect. Is that the idea? In czmq
>> > terms, something like:
>> >
>> > s = zsock_new(ZMQ_REP)
>> > zsock_configure(s, myfunc, myarg)
>> > zsock_bind(s)
>> >
>> > The callback would be provided with the base socket?
>>
>> Nice. That could work because all actual system sockets are created
>> after bind/connect. And in CZMQ we could add a global zys switch that
>> applies it automatically to all sockets to make it more convenient.
>>
>> But the problem is that such callback should be executed for all
>> sockets, be they TCP or IPC or inproc. So, there needs to be a way to
>> discriminate somehow, as what you can do with the FD varies wildly.
>>
>> It could be left to the application developer to be careful, but I
>> think that's confusing and likely to cause troubles.
>>
>
> Rather than a global callback, couldn't you attach the callback to
> individual sockets?
>
> Catch you later (if you're still talking to me!),

I propose both: the low-level library could have the basic feature of
per-socket callback, and the higher level binding in addition could
provide a global setting for convenience.

Kind regards,
Luca Boccassi



More information about the zeromq-dev mailing list