[zeromq-dev] Idea: Create sockets from existing FD

Michael Haberler mail17 at mah.priv.at
Mon Feb 3 21:07:48 CET 2014


Am 01.02.2014 um 13:32 schrieb Goswin von Brederlow <goswin-v-b at web.de>:

> Hi,
> 
> I've been thinking of using zmq for a little daemon. But I also want
> to support systemd socket activation. Now those two combined make a
> problem.
> 
> ZMQ has no way to create a zmq socket given an existing FD. And socket
> activation opens the sockets outside the programm and passes them in
> when the program is started.
> 
> Would it be insane to have e.g.:
> 
> void *zmq_socket_from_fd(void *context, int type, int fd, bool bound);

no, very sane - I like it too.

I dont have immediate use for it: however, in my scenario zeroMQ becomes the Swiss Knife for plumbing components together, and if it aint for me it might help somebody else.

- Michael

ps/OT: there's of course always the danger of the result turning into this: http://www.amazon.de/Wenger-Schweizer-Offiziersmesser-Messer-Schatulle/dp/B000R0JDSI/ref=pd_sim_sbs_k_5
german speakers might enjoy this stunning product review: http://www.amazon.de/review/R3TMSHWHU3KFVQ/ref=cm_cr_dp_title?ie=UTF8&ASIN=B000R0JDSI&channel=detail-glance&nodeID=16435051&store=sports


> 
> Context and type are clear I hope. The fd would be the the file
> descriptor that is already opened and bound would say wether the
> socket is one that was bind()ed or one that was accept()ed/connect()ed.
> 
> 
> This feature would also allow 2 additional use cases:
> 
> 1) restarting without loosing connections (no messages dropped during
>   restart)
> 
> 2) handling stdin / stdout
>   Note: Would that need an additional flag to say wether the
>         socket should allow reads or writes.
> 
> MfG
> 	Goswin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list