asio C++ library Activity
Brought to you by:
chris_kohlhoff
I have done a bit of digging into the code. It seems that what is needed is to add a check for a timeout in socket_ops.ipp, functions sync_recv, sync_recvfrom, sync_recvmsg. Instead of having something like for (;;) { // Try to complete the operation without blocking. signed_size_type bytes = socket_ops::recv(s, bufs, count, flags, ec); // Check if operation succeeded. if (bytes > 0) return bytes; // Check for EOF. if ((state & stream_oriented) && bytes == 0) { ec = asio::error::eof; return 0; }...
That is a great idea.
Add timeout to receive_from().