title: lost messages on zeromq pub sub
body: <p>I'm trying to implement the pub sub design pattern using zeromq framework.
  The idea is to launch a subscriber and afterwards to launch the publisher.
  The subscriber will listen to 100 messages and the publisher will publish 100 messages.
  So far so good...
  However what actually happens is that even that the subscriber is already up and running when the publisher is launched , not all of the messages are received by the subscriber (a 100 messages will be picked up by the subscriber if the publisher will send at least 500 message). It seems that the first messages sent by the publisher are not sent to the subscriber.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks in advance,
  Omer.</p>
  
  <p><em><strong>Subscriber code (launched before the publisher)</em></strong></p>
  
  <pre><code>int i=0;
  zmq::context_t context (1);
  zmq::socket_t subscriber (context, ZMQ_SUB);
  subscriber.connect("tcp://localhost:5556");
  subscriber.setsockopt(ZMQ_SUBSCRIBE, "", 0);
  
  for (int update_nbr = 0; update_nbr &lt; 100; update_nbr++) 
  {        
      zmq::message_t update;
      subscriber.recv(&amp;update);
      i++;
      std::cout&lt;&lt;"receiving  :"&lt;&lt;i&lt;&lt;std::endl;
  }
  </code></pre>
  
  <p><em><strong>Publisher code (launched after the subscriber)</em></strong></p>
  
  <pre><code>zmq::context_t context (1);
  zmq::socket_t publisher (context, ZMQ_PUB);
  publisher.bind("tcp://*:5556");
  
  int i = 0;
  for (int update_nbr = 0; update_nbr &lt; 100; update_nbr++) 
  {        
      //  Send message to all subscribers
      zmq::message_t request (20);
  
      time_t seconds;
      seconds = time (NULL);
  
      char update [20]="";
      sprintf (update, "%ld", seconds);
  
      memcpy ((void *) request.data (), update,strlen(update));
      publisher.send(request);
      i++;
      std::cout &lt;&lt; "sending :" &lt;&lt; i &lt;&lt; std::endl;
  </code></pre>
  
  <p>}</p>