[Qt C++] Packet loss

01/05/2014 15:37 -X-Ni-ck-X-#1
Hi, iam making BOT in Qt c++ for one small game.. Everything works fine.. iam using QTcpsocket::readyRead() and then QByteArray message = socket.readAll();.. but now i found that i miss some packets, like when i track other players positions it does not update everytime, but very often.. I found on internet that the data over sockets are send by packeges, but its size is sent before the package.. and i need wait for when the package is full recieved and then read.. I dont really know how i would do this.. (Theres no problem with the packets, like they are not half-only, but i miss some of them).. Sorry for my english, i hope someone will help me.
There is pic of how the packets looks like:
[Only registered and activated users can see links. Click Here To Register...]
01/05/2014 20:50 Delinquenz#2
Quote:
I found on internet that the data over sockets are send by packeges, but its size is sent before the package..
That depends on the Byte Order.
01/15/2014 16:59 KraHen#3
Size is usually sent in the packet header, which can vary in size (most of the time it will be 4 or 8). Also, I`m not sure how the QT TCP socket class works, but if it is a blocking implementation, some data might be lost. Try an other multiplexing solution, like an IOCP solution.