I have a TCP server and client, with an established socket. Let\'s say I have the following case:
SERVER:
char *fn = \"John\";
char *ln = \"Doe\";
char
instead of sizeof(buffer) use strlen(fn); so it will transmit only the exact amount of bytes.. if you need null terminator together use strlen(fn)+1 but don't forget to concatenate null terminator with strcat()
also if you send all the buffer size without cleaning with memset you'll also have rubbish along, so beware that..