Boost logo

Boost Users :

Subject: [Boost-users] How to use boost::asio to implement a synchronous operation with timeouts?
From: watsonsong (911songfeiyu_at_[hidden])
Date: 2009-12-22 03:15:11

    I'm trying to develop some function that will block until the protocol
exchange finished or some error occur, or timeout.
    In the boost official documents, the example of timeouts in asio is
implements by asynchronous operations and a deadline_timer. But what I want
is a synchronous operation with a timeout, but I search nearly all of the
reference manual and find nothing about it.
    In an other words, how can I used the asynchronous operations to
simulate synchronous operations with timeouts.
    Maybe I could launch an asynchronous operation and call
io_service::run_one immediately, but I don't know whether it is safe when I
call io_service::run_one in a complete callback function which is call by
    Or there is any classic solution of this question.
    Thank you.

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at