On 09. juni 2014 12:59, Carsten A. Arnholm wrote:> Hi,
 >
 > I am trying to use cxxtools::net::UdpReceiver on Raspberry PI to
 > receive messages. I am currently doing this in a loop that should
 > not be interrupted. It works, but too slowly.
 >
 > Right now I am calling poll() on the UdpReceiver object with a zero
 > timeout value, it throws an exception when there is no data. This
 > takes too long, it seems.

I tried the same without calling poll, just calling recv()

It turns out it is also throwing an exception when there is no data in 
the queue and the timeout is reached. From my measurements it takes 
about ~0.05 ms to do the call when there is data, but ~0.3ms when there 
is not, about 6 times longer. I guess it has to do with an exception 
being thrown. I would in this case much prefer if an exception was not 
thrown, and instead the size returned would simply be 0, assuming it 
would be much faster.

I can see that recv has a "flags" parameter, but it is not documented

size_type cxxtools::net::UdpReceiver::recv( void* buffer,
                                             size_type  length,
                                             int  flags = 0);

So, is there a way to call recv (or any equivalent function) that will 
not throw exception, but will tell me in a cheap way if there is data in 
the message queue?

Regards
Carsten Arnholm
        


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to