You are not logged in.

1

Thursday, October 16th 2008, 5:20am

Problem in QTcpSocket

Hi,
I am facing a problem in QTcpSocket.
I need to send consecutive separate packets in network. To send the packets i am using write operation followed by a flush and followed by write once again.
socket->write(data)
socket->flush()
socket->write(data1)
when i flush the packet and execute write of data1 , then first packet will be lost. If i remove the flush then in same packet data and data1 is passed .
I need to pass two packets separately without loosing any of them. Please can anyone tell me how can i accomplish it???

Thank You

2

Thursday, October 16th 2008, 4:12pm

why not

Source code

1
2
3
4
5
socket->write(  quint64( dataSize ) );
socket->write( data );
socket->write(  quint64( dataSize_1 ) );
socket->write( data_1 );
// ...