TCP does not know the concept of "complete" data. The protocol just sends an opaque stream of bytes over network. If you want to know if you read all the bytes you expected then you have to know what to expect in the first place. One of possible approaches is to prepend the block of data with the size of the block. Then the receiving end can read the size and learn how many more bytes it needs to read.
Bookmarks