GabrielGray
30th June 2010, 15:34
Good afternoon,
I am using QTcpServer and QTcpSocket in my application to transfer data, mainly text.
So, the problem appears when i try to send very fast multiple packets.
As an example:
The server needs to send text like this:
stream << numberOfStringsToSend;
for(int i = 0; i < numberOfStringsToSend; i++){
stream << textForThisIteration(i);
}
It seems to be sending everything, but the client doesn't receive it properly. In the client i can get as much as no packet at all or i can get everything correctly, its almost random. Im using the readyRead signal to read from the socket with a QDataStream.
Any hint to solve this problem would be apreciated :x The only way i can think to bypass this, would be sending all the packets in one, but cmon, there must be a way to send packets whenever i want and grant they arrive properly :x
Thanks
I am using QTcpServer and QTcpSocket in my application to transfer data, mainly text.
So, the problem appears when i try to send very fast multiple packets.
As an example:
The server needs to send text like this:
stream << numberOfStringsToSend;
for(int i = 0; i < numberOfStringsToSend; i++){
stream << textForThisIteration(i);
}
It seems to be sending everything, but the client doesn't receive it properly. In the client i can get as much as no packet at all or i can get everything correctly, its almost random. Im using the readyRead signal to read from the socket with a QDataStream.
Any hint to solve this problem would be apreciated :x The only way i can think to bypass this, would be sending all the packets in one, but cmon, there must be a way to send packets whenever i want and grant they arrive properly :x
Thanks