I am trying to send large messages ( 300 MB
) over a REP
-socket.
There are multiple clients, each connecting to the server via a REQ
-socket. The server creates a dedicated socket for every client, waits for the request ( containing an identifier ) and sends the message in two parts using ZMQ_SENDMORE
:
- metadata (~
1 KB
) - data (~
300 MB
)
After that the REP
-socket is immediately closed. The Context()
-instance is then closed in a parent thread. ZMQ_LINGER
time of the socket is left at default ( infinite ).
Sometimes the metadata is sent, but not the image data.
I traced the calls within ZeroMQ and found that the internal (windows) socket is closed before the message data has been sent to the network. I thought that zmq_term()
would block as long as there are unsent messages in the queue.
As a workaround I changed the clients to send another request message after receiving the data as an acknowledgement. This works quite well, but I'm not quite sure if I have addressed the fundamental problem.
The ZeroMQ version is 4.0.4. I am using the C++ bindings. Server and clients all run on Windows ( 7 and 10 ).