[Qt-interest] QUdpSocket issue
Davide
davide83 at gmail.com
Thu Jan 21 12:26:34 CET 2010
Thank you all for the quick reply.
@Jason: All the packets in Wireshark are good, no checksum problems.
@Arnold:
On Wed, Jan 20, 2010 at 8:38 PM, Arnold Krille <arnold at arnoldarts.de> wrote:
> First: Note that udp is a connection-less transaction, it is very likely that
> packets get lost and there is no way in the protocol itself to deal with that.
> And these losses can happen anywhere in the osi-stack.
> Also you should send small datagrams, bigger datagrams are more likely to get
> eaten somewhere inside the stack.
> And the order the packets are received is not necessarily the order in which
> the packets are received...
I know that Udp is a connection-less protocol and can lose some
packets but this doesn't explain why Wireshark receives all the
packets and my socket doesn't. Anyway I cannot change the protocol on
my external device.
@Konrad:
On Thu, Jan 21, 2010 at 7:26 AM, Konrad Rosenbaum <konrad at silmor.de> wrote:
> You probably receive multiple packets at once, so you get signalled once,
> but have to retrieve multiple packets.
>
>> while (1) {
>> if(waitForReadyRead(1500)) {
>
> insert here: while(hasPendingDatagrams()){
I followed your advice but the program's behavior doesn't change. I
still have the same issue: sometimes it works but only if the cpu is
completely dedicated to my application.
I don't know exactly how the UDP stack works in windows but I think
that there is somewhere a FIFO where the OS (or the Qt framework)
stores all the incoming packets that are waiting to be processed. My
idea, based on what happen to my application, is that this FIFO has a
limited size and lose the old packets if my application isn't fast
enough (e.g. when my pc is executing other applications).
Any idea?
Thanks
Davide
More information about the Qt-interest-old
mailing list