| Home | Libraries | People | FAQ | More

##### basic_stream::expires_after

Set the timeout for the next logical operation.

###### Synopsis

    void
    expires_after(
        std::chrono::nanoseconds expiry_time);

###### Description

This sets either the read timer, the write timer, or both timers to expire after the specified amount of time has elapsed. If a timer expires when the corresponding asynchronous operation is outstanding, the stream will be closed and any outstanding operations will complete with the error `timeout`. Otherwise, if the timer expires while no operations are outstanding, and the expiraton is not set again, the next operation will time out immediately. The timer applies collectively to any asynchronous reads or writes initiated after the expiration is set, until the expiration is set again. A call to `basic_stream::async_connect` counts as both a read and a write.

###### Parameters

Name | Description
--- | ---
`expiry_time` | The amount of time after which a logical operation should be considered timed out.