Boost logo

Boost Users :

Subject: Re: [Boost-users] "event-driven" async-receive
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2014-10-23 19:07:16


On 23 Oct 2014 at 10:53, Alexander Carôt wrote:

> I have question regarding the async_receive_from - operation (using UDP):
>
> Right now I have a thread, which triggers the receive call in constant
> intervals. This works allright if the sender sends data in the same interval
> or larger intervals.
>
> However, if the send intervals are (much) smaller (or if multiple senders
> exist) the receive-operation is not triggered often enough.
>
> Eventually I´d like the receiving socket to behave in an "event-driven
> " manner - so, whenever data is there the receive-handler should be invoked.
>
> I used to work with Qt, which works this way (via signals/slots) but since I
> moved to boost I wonder how I can reproduce this behavior.
>
> Can anyone tell how to approach this ?

Always keep an async_receive() pending at all times and supply a
thread pool of executors for asio to issue callbacks onto. You can
easily peg a 1Gbit ethernet connection with a low CPU usage with that
alone.

If you need to max out a 10Gbit or 40Gbit ethernet connection, come
back to us. Those have non-trivial design requirements.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/



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