Hello! I've recently started learning network programming by simple programs. For now, I've made a simple console-based program which sends and receive some char* buffer. This is my issue :
When I send the buffer like this from the server,
//Without sleep function in between functions
SendMessageToClient(tempSock, "Test message\n"); //first message
SendMessageToClient(tempSock, "Another message!\n"); //second message
This is the output from client (i.e Second message does not get received) :
But when I send the buffer like this from the server,
//With sleep in between functions
SendMessageToClient(tempSock, "Test message\n"); //first message
Sleep(10);
SendMessageToClient(tempSock, "Another message!\n"); //second message
This is the output from client (i.e both messages are received):
Why there is a difference when I send the message to client from the server without sleep? (Message does not get received when sleep is not inserted between send functions.)
Full Source code:
Server: http://pastebin.com/1iqera5Y
Client: http://pastebin.com/1iZnsWRP