Boost logo

Boost Users :

Subject: Re: [Boost-users] Passing io_service to socket in implementation file after initialization in header file
From: james (dirtydroog_at_[hidden])
Date: 2018-06-18 19:34:20


No, not per socket. One per port that accepts connections if you're a
server, and one per host you're connecting to if you're a client.

On Monday, June 18, 2018, Vinnie Falco via Boost-users <
boost-users_at_[hidden]> wrote:

> On Mon, Jun 18, 2018 at 11:54 AM james via Boost-users
> <boost-users_at_[hidden]> wrote:
> > You want one io_service per endpoint, not per application.
>
> What? No... You're saying a separate io_context for each socket?
> That's not necessary. These are the common models:
>
> * One io_context, one thread:
> - Implicit strand (no locks needed)
>
> * One io_context, multiple threads
> - Explicit strand needed
> - Different sockets can process data concurrently
>
> * One io_context for each thread
> - Implicit strand (no locks needed)
> - Sockets in different contexts can process data concurrently
> - Passing data between sockets in different contexts requires care
> (e.g. broadcasts)
>
> I know of no benefit to one io_context per socket, nor have I seen an
> implementation which uses that model.
>
> Thanks
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net