[zeromq-dev] equivalent of accept

Varol Okan Varol.Okan at movingsatellites.com
Tue Apr 20 19:14:28 CEST 2010


Martin,

I am really sorry to throw that many questions at you. I am just trying to understand and I am thankful for your help.

I have a server which is idly waiting for a client to connect. At this point I have only one thread.

Once I get a client connection, I want to handle the the traffic in a new thread.

I read in the zmq doc, that the socket will only handle send/recv from within the same thread it was created, so I can't just pass the context to the newly created client handler thread.

A second client gets a second thread etc. this is how the current application works. I would like to use zmq for this, hence all my questions :)

Can you guide me to documentation which describes a server implementation with multiple worker threads and multiple sockets using zmq ?
Or tell me how you would use zmq to handle multiple client connections through multiple threads 

I think I read the whole documentation and example codes to no avail, so I really appreciate your help.

Regards,

Varol :)


On Tuesday 20 April 2010 12:45:16 pm Martin Sustrik wrote:
> Varol,
> 
> > I want to have a server waiting for clients on port 5500
> > 
> > Then shift the communication to a separate thread and have the
> > clienthandler thread do the communication with the client and have the
> > main server thread free to listen to incoming clients.
> > 
> > I expect some heavy logic to be exercised in clienthandler which can
> > keep the thread unresponsive for a few seconds, that is why I want the
> > server thread freed of the workload and ready or new incoming client
> > requests ( from different machines )
> > 
> > Again, I might be completely off with my understanding of ZMQ
> 
> 0MQ does this for you. Actual networking stuff is done in I/O thread(s). 
> Your application thread is free to do the actual processing.
> 
> Martin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 



More information about the zeromq-dev mailing list