title: ZeroMQ: REQ/REP with large messages
body: <p>I am trying to send large messages ( <code>300 MB</code> ) over a <strong><code>REP</code></strong>-socket.<br>
  There are multiple clients, each connecting to the server via a <strong><code>REQ</code></strong>-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 <strong><code>ZMQ_SENDMORE</code></strong>:</p>
  
  <ol>
  <li>metadata (~ <code>1 KB</code>)</li>
  <li>data (~ <code>300 MB</code>)</li>
  </ol>
  
  <p>After that the <code>REP</code>-socket is immediately closed. The <code>Context()</code>-instance is then closed in a parent thread. <strong><code>ZMQ_LINGER</code></strong> time of the socket is left at default ( infinite ).
  Sometimes the metadata is sent, but not the image data.<br>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 <strong><code>zmq_term()</code></strong> would block as long as there are unsent messages in the queue.<br>
  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.<br><br>
  The ZeroMQ version is 4.0.4. I am using the C++ bindings. Server and clients all run on Windows ( 7 and 10 ).</p>