[Boost-bugs] [Boost C++ Libraries] #13496: ASIO: Ability to do a synchronous read with timeout on a socket

Subject: [Boost-bugs] [Boost C++ Libraries] #13496: ASIO: Ability to do a synchronous read with timeout on a socket
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-03-28 07:11:19

#13496: ASIO: Ability to do a synchronous read with timeout on a socket
 Reporter: tom@… | Owner: chris_kohlhoff
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost 1.67.0 | Severity: Problem
 Keywords: |
 This is a restatement of the issue #2832, in a different form.

 It's clear there is an appetite to be able to perform a synchronous read
 with a timeout using asio.
 Issue #2832 raised this issue. The main objection there seemed to be the
 form in which the functionality was proposed. I don't think there was a
 fundamental objection to the requirement.

 Similar functionality DOES exist on the basic_socket_streambuf. You can
 set an "expiry". The read functionality in that class mirrors the code in
 the socket_opts::sync_recv, it just adds a timeout to the poll call
 (though it does also remove the initial blocking wait, but that would be
 easy to conditionalise). To me, this gives an obvious route for
 implementation within the socket class.

 Note that although I talk about sockets here, I suspect the same
 would/should apply to other forms. I have only been looking at this from a
 socket perspective as it's what I'm trying to do, and I have specifically
 been trying to solve the situation for sockets. I don't know whether this
 applies equally or not to other I/O types.

 Note that although the boost library is called "asio", the N4656
 specification is more open, and is a more general networking library
 description, and doesn't use "asynchronous" in its name.

 Could consideration be given to this?
 At the moment for example, I don't believe that it's possible to use
 boost::asio to write something like a fully synchronous, thread-per-
 connection HTTP server that implemented a keepalive, since that would have
 to perform a blocking read for another request for the keepalive interval
 before terminating the connection. Now you may say, well you should be
 writing is asynchronously, but for some applications this much simpler
 model is more appropriate (low volumes of requests where each request is a
 POST that takes considerable time to process for example). And any general
 networking library ought to support being able to write such an

Ticket URL: <https://svn.boost.org/trac10/ticket/13496>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2018-03-28 07:15:59 UTC