[zeromq-dev] Question about zero-copying, local and remote clients

Mateusz Jemielity m.jemielity at is-wireless.com
Tue Sep 13 21:37:10 CEST 2016



I have a question about 0MQ's internal use of zero-copy.


Suppose that I have a client-server setup using req/rep sockets that are
sending large messages between themselves. There are multiple clients, some
may run on the same host as the server, others are on remote hosts. All
endpoints use tcp, so I'd have:

Server: zmq_bind(server_socket, "tcp://*:5000");

Client 1 (on same host): zmq_connect(client1_socket,

Client 2 (on remote host): zmq_connect(client2_socket,


Does 0MQ somehow know that server and client 1 are on the same machine? If
it knew, then it could, for example, use shared memory to transfer the
messages, without actually using tcp stack.

I guess I could explicitly use ipc transport for processes on same host and
do another bind in the server, but can I do it in such kinda-generic,
single-bind way?


If 0MQ doesn't do this internally, can I get requester's endpoint string in
the server? Or at least some indication of endpoint being local or remote?
If I had the endpoint, then I could parse it for "" or "localhost",
etc. and then set up a scheme for sending some shared memory parameters
instead of a giant message.


Finally, whetever's the answer for req/rep, does it apply for pub/sub, etc?




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160913/f3a31837/attachment.htm>

More information about the zeromq-dev mailing list