title: Why does my C++ ZeroMQ subscriber not receive any data?
body: <p>My (Python) publisher:</p>
  <pre><code>import zmq
  import time
  
  context = zmq.Context()
  socket = context.socket(zmq.PUB)
  connectStr = &quot;tcp://*:%d&quot; % 5563
  socket.bind(connectStr)
  
  messageNum = 0
  while True:
      ++messageNum
      message = &quot;Testing %d&quot;%messageNum
      print(&quot;Sending.. '%s'&quot;%message)
      socket.send_string(message)
      time.sleep(1)
      messageNum += 1
  </code></pre>
  <p>My (C++) subscriber (running in GTest):</p>
  <pre><code>TEST(ZeroMqPubSubTest, SubscribeGetsData)
  {
  
      // Set up the subscriber we'll use to receive the message.
      zmq::context_t context;
      zmq::socket_t subscriber(context, ZMQ_SUB);
      // Connect to the publisher
      subscriber.connect(&quot;tcp://127.0.0.1:5563&quot;);
      subscriber.setsockopt(ZMQ_SUBSCRIBE, &quot;&quot;); // Set the filter blank so we receive everything
  
      zmq::message_t response(0);
      EXPECT_TRUE(subscriber.recv(&amp;response));
  }
  </code></pre>
  <p>I start up the publisher then start up the subscriber. The latter never returns though.</p>
  <p>If I run a Python subscriber doing (I thought) exactly the same thing..</p>
  <pre><code>import zmq
  
  context = zmq.Context()
  socket = context.socket(zmq.SUB)
  socket.connect (&quot;tcp://127.0.0.1:5563&quot;)
  socket.setsockopt_string(zmq.SUBSCRIBE, &quot;&quot;)
  
  print (&quot;Waiting for data...&quot;)
  while True:
      message = socket.recv()
      print (&quot;Got some data:&quot;,message)
  </code></pre>
  <p>..it works fine:</p>
  <blockquote>
  <p>Waiting for data...</p>
  <p>Got some data: b'Testing 8'</p>
  <p>Got some data: b'Testing 9'</p>
  </blockquote>