[zeromq-dev] equivalent of accept
Varol Okan
Varol.Okan at movingsatellites.com
Tue Apr 20 15:26:27 CEST 2010
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 :)
More information about the zeromq-dev
mailing list