Boost logo

Boost Users :

Subject: Re: [Boost-users] Networking TS + Beast, NEW Tutorials, Read this to learn std::net !!!
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2019-03-15 12:07:46


On Fri, Mar 15, 2019 at 2:45 AM Cristian Morales Vega
<cristian_at_[hidden]> wrote:
> I have not used the synchronous API at all. But section 3.1 of P1269R0
> seems to make a good point about the lack of timeouts in synchronous
> calls, doesn't it?
> beast::basic_stream makes using timeouts in the async API way simpler,
> but is the sync API really basically unusable because of the lack of
> timeouts thing?

Synchronous APIs are perfectly fine. Asio defines SyncReadStream and
SyncWriteStream named requirements, allowing for generic algorithms to
be implemented. Not everything is a socket (for example, a serial
port). A synchronous stream represents the reliable, in-order delivery
of bytes using functions that block, nothing more and nothing less.
For example, serial file I/O can be represented using a synchronous
stream. If the synchronous stream requirements mandated timeouts, it
would eliminate a broad set of implementations (including sockets on
some platforms).


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