
Akos wrote:
I'm having a very basic issue: when sending a large number of UDP messages in short succession via boost::asio, even to localhost, after a few hundred messages, there seems to be a serious loss.
please see a sample code here: http://pastebin.com/Bq0DnkeG
I am no ASIO expert, but a few things came to mind: 1) As far as I know, it is not safe to do a async_send operation on a socket before the previous async_send operation has completed. I have seen this mentioned somewhere in the documentation, but can't find the place now. 2) Line 56: The logic in handle_send_to seems flawed. It issues a async_receive_from()? I would expect it to either send another UDP packet or just check the error code from the original send operation. 3) Line 116: The lifetime of the buffer passed to send() may end before the async operation completes. This will likely not cause the issues seen here, but worth mentioning. Have you tried - just for debugging - changing the send() operation to be synchronous? Have a nice weekend, Martin Dyring-Andersen