[Qt-interest] QTcpSocket very slow to read with lots of data.
David Boosalis
david.boosalis at gmail.com
Thu Mar 4 18:46:08 CET 2010
I don't know what to make of it. QtcpSocket behaves very on Windows when the
data packers arrive every 800ms, but as soon as I turn up the volume on the
server to send every 300 ms. QTcpSocket starts to fall way behind, like two
minutes over an hour. (I know because we compare it to a third party
application accessing the same server and it keeps up). When we look at the
packets coming in with Wire Shark. they appear to come in on time every
time, yet QTcpSocket seems to be taking a lunch break as it does not read
them that fast.
The QTcpSocket runs in its own QThread. I've raised the priority of this
thread to the highest, but it did not help. We are using QT 4.6.2 on
Windows 32 bit. Xxp and Vista both exhibit this slow behavior. I have tried
turning off the Nagel buffering with the following in the slot that connects
to QTcpSocket::connected() signal.
sockID = serverSocket->socketDescriptor();
flag = 1;
ret = setsockopt( sockID, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
sizeof(flag) );
This did not help. Maybe the socket's buffer is getting to full, although
I do not touch the QAbstrackSocket::setReadBufferSize(int) at all, but keep
it to its default value of 0.
When I check Window's task manager there is no evidence the application is
consuming any significant amount cpu or memoy.
Any ideas as to why QTcpSocket is running so slow. If so I'd really
appreciate hearing from you.
Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100304/866be9e4/attachment.html
More information about the Qt-interest-old
mailing list