title: JeroMQ subscriber connection breaks when recv-ing in Matlab
body: <p>Using JeroMQ in Matlab, my subscriber connection drops when I try to <code>recv</code> a message. I have verified this with Wireshark. I also note that the closing of the TCP connection is initiated by my subscribing port, not the publishing port. </p>
  
  <pre><code>javaclasspath('jeromq-0.5.1.jar')
  import org.zeromq.*;
  
  ctx = zmq.Ctx();
  socket = ctx.createSocket(ZMQ.SUB);
  socket.connect('tcp://127.0.0.1:5996')
  message = socket.recv(1) %this is when the connection gets dropped
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/QJ9ha.png" rel="nofollow noreferrer">Wireshark screenshot showing connection being closed</a></p>
  
  <p>I don't know for sure if it would help, but I have investigated using this,</p>
  
  <pre><code>socket.setSocketOpt(ZMQ.ZMQ_TCP_KEEPALIVE,1)
  </code></pre>
  
  <p>but Matlab reports that ZMQ_TCP_KEEPALIVE is an unrecognized function or variable.</p>
  
  <p>I am indebted to the folks on <a href="https://stackoverflow.com/questions/38060320/how-to-use-jeromq-in-matlab/44865494#44865494">this</a> thread for getting me started on the right foot with JeroMQ in Matlab.</p>