Additional Information
The problem may be in TCP protocol itself, so you need to choose and implement a suitable TCP/IP protocol communication.
First of all, you can try to use one of the following techniques to handle messages:
- Send messages that are preceded by a fixed size header that describes the message
- Make each message a fixed size
- Send messages that are strictly ASCII in content, where each message is terminated by a carriage return and linefeed pair of characters
More details can be found in
TCP Write Function help page .