What language are you using?
And are you checking how many bytes you receive with each block of data you receive, and making sure to use ONLY that number of bytes? For instance in c, you could end up doing something like this:
Code:
char buffer[256];
recv(sock, buffer, 256, 0);
printf("%s\n", buffer);
And if you actually only recv 5 bytes the first 5 bytes will be what you received and the last of them would be garbage and probably displayed if the data wasn't sent as a null-terminated string. (e.g. if the sending app sent "hello" instead of "hello\0" your buffer would end up having so mething like "hellowhatevergarbagewasherebeforethereceiveetc...").
Instead, you would do something like so:
Code:
char buffer[256];
int n;
n = recv(sock, buffer, 256, 0);
// NULL terminate the string
buffer[n] = '\0';
printf("%s\n", buffer);
Obviously, if you are receiving binary data, you probably wouldn't be null terminating it like that, but you should still be checking how many bytes are received and only operating on that number of bytes.