|
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-05-22 08:24:05
Hi,
I've already replied in an earlier private email conversation,
but for the benefit of the list...
> I'm trying to use boost::asio, and I find that there isn't a
> built-in timeout parameter in any async operation. I think
> it's a very important function when writing real life
> programs, and I have done some walk around work, how can I try
> to contribute?
There isn't a way to implement timeouts on the individual async
operations both efficiently and portably. E.g. the async I/O
functions on windows (like AcceptEx etc) don't support timeouts.
Instead, the intended approach is to use a deadline_timer object
and start a timer when you start the operation. The examples
under example/timeouts illustrate this.
In my experience timeouts can often apply at a coarser
granularity than the socket's send and receive operations. For
example you might develop a high level function that receives a
complex message (such as an HTTP reply) and want to set a
timeout for receiving the entire message. However the
implementation of this high level read function wouldn't need to
be aware that a deadline_timer is being used.
Cheers,
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk