|
Boost Users : |
Subject: Re: [Boost-users] asio UDP message packet loss even on localhost?
From: Ãkos Maróy (akos_at_[hidden])
Date: 2010-10-22 10:53:59
Martin,
thanks for your feedback.
> 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.
it might be. then again, all send events seem to complete find, as the
send callback is called the proper number of times.
> 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.
this is a leftover from the boost asio sample code I copied it over
from, see here:
http://www.boost.org/doc/libs/1_44_0/doc/html/boost_asio/example/echo/async_udp_echo_server.cpp
removing it actually solves my issue. wow - I wouldn't have thought :)
now I'm hitting the following barriers:
b sent 200000 messages
a received 199597 messages
b sent 2000000 messages
a received 1990728 messages
these both seem to be over 99% fidelity, which is, well, sort of OK :)
> 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.
actually an asio::buffer object is created in send(), which copies the
contents over. this is the same pattern as used in the same sample code
quoted above.
> Have you tried - just for debugging - changing the send() operation
> to be synchronous?
actually haven't.
Akos
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net