title: How could I retrieve and store random UUID-s in ZeroMQ sockets?
body: <p>I need to communicate between multiple clients. When I try to run file (multiple terminals) I get same identity. So I let router socket to automatically set the UUID. But what I found I cannot use that identity to store at server for routing between multiple clients.</p>
  
  <p>How would I handle multiple clients IDs?</p>
  
  <p>I am trying to build an asynchronous Chat server. I am following an approach of each client with dealer socket connects to server ( <strong><code>ROUTER</code></strong>-type sockets ). Server then extract the clients IDs ( set manually ) and reads the message and route accordingly. </p>
  
  <pre><code>#include "zhelpers.hpp"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  int main(void) {
      zmq::context_t context(1);
      zmq::socket_t backend (context, ZMQ_DEALER);
      backend.setsockopt( ZMQ_IDENTITY, "mal2", 4);
      backend.connect("tcp://localhost:5559");
  
      std::string input;
      std::cout &lt;&lt;"you are joinning" &lt;&lt; std::endl;
  
      while(1){
          getline (std::cin, input);
          s_send (backend, input);
          zmq::pollitem_t items [] = {
              { backend, 0, ZMQ_POLLIN, 0 }
          };
          zmq::poll (items, 1, -1);
          if (items [0].revents &amp; ZMQ_POLLIN) {
              std::string identity = s_recv (backend);
              std::string request = s_recv (backend);//receive reply back from router which might be other client
              std::cout&lt;&lt;"identity="&lt;&lt;identity&lt;&lt;"reques="&lt;&lt;request&lt;&lt;std::endl;
          }   //ending if                               
      }//ending while
      return 0;
  }
  </code></pre>