[zeromq-dev] Socket use from several threads

Chuck Remes lists at chuckremes.com
Tue Jul 17 14:58:34 CEST 2012


On Jul 17, 2012, at 6:27 AM, moteus wrote:

> Hi.
> 
> I have some service. 
> Service creates new thread for each request and call function from .dll to
> proceed this request.
> I write only .dll and can not change service.
> What best method to use REQ/REP sockets over inproc and tcp.
> If I understood correctly i have to create new context (tcp) and socket for each
> new thread? Or i can create some pool of sockets and use them at the same time
> only from one thread?

You should create only ONE context. The context can be passed to each thread; any socket you create in a thread should only be used from that thread.

I recommend that you read the guide and the FAQ. These ideas are discussed in both places.

cr




More information about the zeromq-dev mailing list