Simple Protocol This example always send first 4 bytes with data length and later data. So server knows how many data it has to receive.