Opened 10 years ago
#7897 new Feature Requests
Add timeout parameter to all Boost::ASIO socket operations
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost Development Trunk | Severity: | Not Applicable |
Keywords: | Cc: |
Description
Right now the user has to implement some code in order to implement timeouts to be used with ASIO.
A better way is if ASIO could handle timeouts internally.
For example, take the method async_connect. A new 4-byte integer parameter could be added to the function signature that when greater than zero, would specify the number of milliseconds to wait before timing out. If the value specified was set to zero, then the code would use whatever default timeout that the raw socket was set to use. If it was set to less than zero, then it would set the timeout to the maximum value or not use a timeout.
A timeout parameter should be added to any ASIO method call that uses or may use a socket read, write, or connection function. If a method is buried that uses a socket connection, then the class it is in should provide a way to specify the timeout value.