[zeromq-dev] ZeroMQ STREAM Socket Type

Peter Witkowski pwitkowski at gmail.com
Mon May 23 23:04:27 CEST 2016

Sorry to spam everyone, but just to clarify, when I say that PUSH-PULL
doesn't work because of handshaking, I'm speaking about the ZeroMQ
handshake (greetings, etc.).  The data link handles the TCP connection

On Mon, May 23, 2016 at 4:58 PM, Peter Witkowski <pwitkowski at gmail.com>

> Hello,
> Long story short, I have code that works that I now need to refactor.  The
> networking for my application has changed and I need to push my ZeroMQ
> messages over a half-duplex (i.e., one way) wireless data link.  The data
> link is looking for raw TCP on either end and specifies what side is the
> client and server.  You can think of this data link as a one way bridge,
> with a TCP endpoint on either end that I need to talk to.  The data link
> then forwards the TCP traffic in some weird protocol to the other side.
> The code I have written is a PUSH-PULL pattern, which doesn't work due to
> the handshaking involved at the socket's start-up (I'm assuming there's no
> way to disable this).  The code sends and receives a three-part message
> (the third message part is large, about 65KB).  I need to refactor this
> into two STREAM sockets, but I'm having problems (conceptually) with
> sending and receiving.
> Here's some pseudo code for the sender (which is the client per the data
> link):
>    - Set-up context, open socket, call connect.
>    - Get ZMQ_IDENTITY using zmq_getsockopt()
>    - Send identity
>    - Send message part 1 (assuming that this is an atomic send and won't
>    only send N bytes)
>    - Send identity
>    - Send message part 2 (see previous assumption about atomic)
>    - Send identity
>    - Send message part 3 (see previous assumption about atomic)
>    - When I'm ready to close, I send the identity followed by a zero
>    length packet
> The receiver (TCP server per the data link) is basically the opposite, but
> here I'm a bit confused.  Namely, is each receive call atomic, or is there
> a chance that the data gets chunked up into multiple messages?  Also, do I
> need to read off the identifier each time or does the library only forward
> the message parts?
> Also, in general, are there any issues with using ZeroMQ (even STREAM
> sockets) with this set-up?  Note that my assumption is that the receiver
> never needs to send data and the sender never needs to receive data.
> Thanks in advance for the help.
> --
> Peter Witkowski
> pwitkowski at gmail.com

Peter Witkowski
pwitkowski at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160523/3790902b/attachment.htm>

More information about the zeromq-dev mailing list