From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-12-13 15:58:29
--- Arkadiy Vertleyb <vertleyb_at_[hidden]> wrote:
> Now that I spent some time reading through you tutorial I have
> a question -- what exactly is the demuxer object? At first I
> thought that it somehow relates to the "demultiplexer"
> pattern. However, considering a simple TCP client, which just
> connects to the server, sends a request, and then reads the
> response, I don't see how demultiplexer is related here. If I
> write a similar program using winsock, I can't see anything
As Eugene said it does act as a sort of service repository. In
the past I have considered splitting them into two separate
objects, however opted not to because I felt it impacted
negatively on usability. Your typical user doesn't want to know
about the services (see the many requests for me to split the
reference documentation into two parts so that the services and
basic_* templates are not intrusive).
Therefore I prefer to talk about the demuxer as a multi-faceted
object, not completely unlike std::locale. Its primary facet
(i.e. the one accessible via asio::demuxer) is the one that
everybody must use if they are going to do any asynchronous
operations at all, regardless of whether they use sockets,
timers or something else.
As for why the sockets must take the demuxer object even if you
are just doing synchronous operations... I mean you could have a
socket implementation that excluded the asynchronous operations,
and a demuxer wouldn't be required in that case. But ultimately
this library is about asynchronous I/O.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk