PDA

View Full Version : QTCPSocket data tranfser



A9am
10th October 2013, 05:55
Hi,

I have two applications , a server and a client. My requirement is to send 20 bytes packets continuously to the server for which the server should acknowledge the client with another 20 bytes packet.

I am sending each 20 bytes packet to server. Server is using the readyRead signal to receive data. But the signal is emitted only after transferring the last 20 bytes packet and data received is a large packet(Combining all the packets).

I want the readyRead signal to be emitted for each 20 bytes packet.So that I can send back the acknowledgment from the server.

Please advice any method.

Thanks In Advance :)

wysota
10th October 2013, 06:20
You need to force flusing the socket on the sending side. However this won't guarantee you'll get a separate readyRead() signal for each packet on the receiving side. Nothing will guarantee that except changing the protocol as this is how TCP works -- it has no notion of "records" or "messages", just a contignous flow of bytes.

anda_skoa
11th October 2013, 10:34
If you want to deal with individual packets then you need a packet oriented protocol, rather than a stream oriented on, as wysota has pointed out.
E.g. UDP instead of TCP

Cheers,
_