Hi all,
I am currently using GCC compiler and SunSolaris 8 as my platform. I am trying to program a stream socket (TCP) that send two messages to the server. The code is as follow:
send(socket, msg, strlen(msg));
send(socket, msg1, strlen(msg1));
The server is using 2 recv() to receive the corresponding messages. However, the first recv() sometimes receive both the msg & msg1 together and the second recv() receives nothing thus hanging the whole program. Even worse is that sometimes the first recv() recieves the whole msg but part of the msg1, then the second recv() receives the rest of the msg1.
I have tried to put sleep(1) between the two send() and it solved the problem, however due to performance reason I have got to remove the 1 second delay.
This is kind of weird, could somebody help me in that?
Thanks and regards,