[Interest] Not quite a Qt question.. Buffers in QAbstractSocket

wargand at gmx.de wargand at gmx.de
Sun Jun 17 01:58:56 CEST 2012


I have a question, which might not be directly Qt related.
I am writing an application, which streams a move to my TV.
The connection is initiated from the TV via TCP/IP. QTcpSocket
is used. For certain reasons I send my data in packages even
though it is TCP and not UDP. But since packages are sent
continuously it is a constant data stream. So far, so good.

My programm runs under Linux and OS X. And now it gets
strange and I might miss something important. Under
Linux I set the package size to 4k. The programm runs
rock stable. Exactly the same code under OS X causes
the TV to disconnect after a few seconds. When I reduce
the package size under OS X to 2k the program again
runs fine with no problems at all.

I have no idea what could cause the difference. I thought
I read somewhere that the write buffer size in the socket
implementation of Qt is unlimited. So I really don't see
what difference it could make, whether I fill this buffer
in chunks of 2k or 4k. The TV should read from the buffer
in its own time. I tried to get information from the
QTcpSocket::write return value, tried to use the bytesWritten
signal, but everything looks fine. The TV just disconnects
without any hint on my programs side that something is wrong.

Anyone an idea what the problem could be? Unfortunately I
cannot get any feedback from the TV. Something related to
different network cards perhaps?
Generally I don't care whether the package size is 2k, or
4k, 510k, I just would like to understand the problem and
if possible be able to predict the maximum package size
I can use for a given system.

More information about the Interest mailing list