title: ZeroMQ PUB/SUB - why won't multiple subscribers work?
body: <p>I'm using ZeroMQ to facilitate a publish/subscribe environment I'm needing. I'm running a publish server on machine A using Python (using EventLoop), and right now I have one subscriber running in C++ on machine B and a second subscriber running in Python (using EventLoop) on machine C.</p>
  
  <p>If machine B subscribes to machine A before machine C does, then B gets subscribed messages and C does not. Furthermore, if I look at the established connections on machine A, there only exists a connection for machine B but not for C. If machine C subscribes to A before B does, then it's the other way around.</p>
  
  <p>Here's my publisher code:</p>
  
  <pre><code>import zmq
  from zmq.eventloop import ioloop, zmqstream
  
  ioloop.install()
  
  context   = zmq.Context(1)
  socket    = context.socket(zmq.PUB)
  publisher = zmqstream.ZMQStream(socket)
  socket.bind("tcp://*:1337")
  
  def publish():
    publisher.send_multipart(("heartbeat", "OHAI"))
  
  ioloop.PeriodicCallback(publish, 5000).start()
  ioloop.IOLoop.instance().start()
  </code></pre>
  
  <p>Here's my Python subscriber code:</p>
  
  <pre><code>import zmq
  from zmq.eventloop import ioloop, zmqstream
  
  ioloop.install()
  
  context    = zmq.Context(1)
  socket     = context.socket(zmq.SUB)
  subscriber = zmqstream.ZMQStream(socket)
  socket.setsockopt(zmq.SUBSCRIBE, "heartbeat")
  socket.connect("tcp://pub.local:1337")
  
  def subscription(message):
    print "Message Received: %s" % (message[1])
  
  subscriber.on_recv(subscription)
  ioloop.IOLoop.instance().start()
  </code></pre>
  
  <p>Why isn't my publisher accepting multiple incoming subscriber sockets? It's probably worth noting that multiple subscribers works fine when running them on machine A, but I don't think it's a firewall issue because I tested subscriber connections from B and C to A with the firewall disabled.</p>