[zeromq-dev] Pull Request: Allow clients to get origin of messages

Pieter Hintjens ph at imatix.com
Mon Jan 6 10:55:14 CET 2014


I merged the pull request (by default, we approve :-). What would be
useful would be a test case that shows the functionality working, and
shows edge cases (even if they are not resolved yet).

On Mon, Jan 6, 2014 at 10:45 AM, Stefan Radomski
<radomski at tk.informatik.tu-darmstadt.de> wrote:
> Hi there,
>
> I just submitted a pull request that will allow client applications to
> retrieve the origin of messages by exposing the TCP file descriptor per
> message. You can get the FD via:
>
> int srcFd = zmq_msg_get(&msg, ZMQ_SRCFD);
>
> and then use getpeername(2) to get the origin of the message. The changes
> are rather small in scope: I did have to introduce a new field (fd) in the
> content field of a message and socket_base. There were quite some posts in
> the past regarding this functionality and I’d like to argue that the
> overhead, both in terms of runtime and memory as well as maintenance is
> miniscule.
>
> At the moment, this will only work for sockets from TCP connections,
> messages from other sources will return -1. If this pull request finds
> approval, I will submit another one with updated documentation. Please
> review it with some scrutiny as I am not intimately familiar with the inner
> workings of zmq.
>
> Best regards
> Stefan
>
> _______________________________________________
> 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