title: C++ and Python ZeroMQ 4.x PUB/SUB example does not work
body: <p>I can only find old C++ source examples. Anyways, I did mine, based on them. Here's my publisher in python:</p>
  
  <pre><code>import zmq
  context = zmq.Context()
  socket = context.socket(zmq.PUB)
  socket.bind("tcp://*:5563")
  
  while True:
      msg = "hello"
      socket.send_string(msg)
      print("sent "+ msg)
      sleep(5)
  </code></pre>
  
  <p>And here's the subscriber in C++:</p>
  
  <pre><code>void * ctx = zmq_ctx_new();
  void * subscriber = zmq_socket(ctx, ZMQ_SUB);
  // zmq_connect(subscriber, "tcp://*:5563");
     zmq_connect(subscriber, "tcp://localhost:5563");
  // zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, "", sizeof(""));
  
  while (true) {
      zmq_msg_t msg;
      int rc;
  
      rc = zmq_msg_init( &amp; msg);
      assert(rc == 0);
      std::cout &lt;&lt; "waiting for message..." &lt;&lt; std::endl;
      rc = zmq_msg_recv( &amp; msg, subscriber, 0);
      assert(rc == 1);
  
      std::cout &lt;&lt; "received: " &lt;&lt; (char * ) zmq_msg_data( &amp; msg) &lt;&lt; std::endl;
      zmq_msg_close( &amp; msg);
  }
  </code></pre>
  
  <p>Initially, I tried <code>zmq_setsockopt( subscriber, ZMQ_SUBSCRIBE, "", sizeof("") );</code> but I guess I should receive everything if I don't set this, right? So I commented it. </p>
  
  <p>When I run the code, I see "waiting for message..." forever.</p>
  
  <p>I tried to listen to TCP traffic using <strong><code>tcpdump</code></strong>. Turns out that when the publisher is turned on, I see a lot of garbage on the <code>5563</code> port, and when I turn the publisher off, they stop. When I tried a <code>PUSH/PULL</code> scheme, I could see the plaintext message in <code>tcpdump</code>. (I tried pushing with nodejs and pulling with c++ and it worked).</p>
  
  <p>What could I be doing wrong?</p>
  
  <p>I tried different combinations of <code>.bind()</code>, <code>.connect()</code>, <code>localhost</code>, <code>127.0.0.1</code>, but they won't work either.</p>
  
  <p><strong>UPDATE</strong>: I've just read that I must subscribe to something, so I did <code>zmq_setsockopt( subscriber, ZMQ_SUBSCRIBE, NULL, 0 );</code> to subscribe to everything but I still receive nothing</p>
  
  <p>PyZMQ is in version 17.0.0.b3 and has ZeroMQ 4.2.3 </p>
  
  <p>C++ has ZeroMQ 4.2.2</p>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>Updates both to 4.2.3, won't work either.</p>