On Tuesday 20 April 2010 10:03:19 am Martin Sustrik wrote:
> You don't have to care about accepting t
> 

Yes but how do I decouple the main server loop from the client handler loop ? 
I.e. I'll get a new FD to talk to the client through accept, which will allow 
the main server thread to wait for other clients to connect and have the 
client handler do the work of this one client.

So basically I want to port the code below to use zmq.

 // Main server loop, waiting for client connections.
  while ( 1 )  {
    iClientHandlerFD = accept ( iSocketFD, (struct sockaddr *) &cli_addr, 
(socklen_t *)&clilen );

    if ( iClientHandlerFD < 0 )  {
      perror ( "ERROR on accept" );
      return -1;
    }
    pthread_t thread;
    ClientHandler *pHandler = new ClientHandler ( iClientHandlerFD );
    pthread_create ( &thread, NULL, startNewClient, (void *)pHandler );
  }

Thanks,

Varol :)
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to