[Qt-interest] QUdpSocket issue
Davide
davide83 at gmail.com
Wed Aug 31 18:49:58 CEST 2011
I found out that Windows by default limits the socket buffer size.
Here's the solution:
#include "winsock2.h"
#include <windows.h>
int v = -1;
if (::setsockopt(MyQUdpSocket->socketDescriptor(), SOL_SOCKET,
SO_RCVBUF, (char *)&v, sizeof(v)) == -1) {
return 0; // error!
}
v is the buffer size in bytes (-1 is unlimited).
Hope this helps.
Cheers
Davide
On Thu, Jan 21, 2010 at 19:22, Thiago Macieira <thiago at kde.org> wrote:
> Em Quinta-feira 21 Janeiro 2010, às 12:26:34, Davide escreveu:
>> 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).
>
> Qt's buffers are unlimited in size. So if Qt gets the packet, it won't discard
> it.
>
> However, QUdpSocket is unbuffered. You're talking directly to the OS buffer.
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Senior Product Manager - Nokia, Qt Development Frameworks
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
Davide Ghezzi
More information about the Qt-interest-old
mailing list