TCP data is passed as a stream read as packets. You need to be able to detect the end of message. Often the message has a header which goes the size of the message. When you have read as many bytes as the message size you have the complete message. Additional bytes would be the next message.
in your case it looks the message is xml. You know you’ve read the full message when the </ROOT> has been read. Again any bytes after are the next message. The best approach would be using a streaming xml parser so you can detect the end of the xml stream.