[zeromq-dev] equivalent of accept

Martin Sustrik sustrik at 250bpm.com
Wed Apr 21 12:58:40 CEST 2010


Hi Varol,

> 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.

As far as I understand, what you want is a multi-threaded server. In 
other words you have a server application which listens on a port. 
Client connect to it and send their requests. Server dispatches these 
requests to worker theads that process them and send the replies back to 
the original clients.

Is that right?

Martin



More information about the zeromq-dev mailing list