How much data to send over a network?
I'm not sure if QTcpSocket auto-chunks data or not. I'd like to send about 50 kb of information in one message, but I can't find any guidelines as to whether or not that is a good idea. I could split that message up easily, but I'm not sure if it's necessary or how many parts I should split it into. Basically I'm just looking for a generalized "ok" amount of data to send per message.
The maximum message size depends on the medium used to transmit this data. Check the MTU (maximum transfer unit) of your connection. In general you can not be sure how many bytes will be sent and received in one package. With IPv4 the routers on the way may fragment a package, so even if you manage to sent one package you may receive several.
It is save to send any amount of data in one go through a socket. The other side will get all the data eventually, you just can't be sure how many packets the data will be send as.
Basically think of a TCP socket as a pipe: Whatever data you stuff in at one end will come out in the same sequence at the other. The timing might differ though: If you pause between putting data into the pipe that pause may or may not be present at the other side. Big packets you push into the pipe in one chunk may come out in smaller chunks (with delays!) at the other side. There is no way to make sure that one chunk you put into the pipe will come out as one chunk on the other.
Don't split the data yourself, the TCP/IP Stack implementation will do this. If the user has a state-of-the-art NIC, then some of the segmentation might be done in hardware ( @ the NIC ) etc. in order to achieve a higher performance.
Yeah, I also think that you just push data to the stream and the cloud(NIC or whatever network device you have in the middle) takes care of slicing data as it seed fit.This idea of writing to and reading from the stream has always fascinated me!
That's the beauty of TCP: it provides a quite reliable stream on top of a quite unreliable packet-based network protocol :-)