Winsock messages getting eaten!
Hey everyone, I'm having some difficulties here with winsock. This is my code, in simplified pseudo-form:
Code:
Client-side:
-send a file
-when finished sending, recv() 1 byte from server to know that
the server is done receiving
-immediately send another message to the server, telling it to
send the directory listing
Server-side:
-receive a file
-when finished receiving, send() 1 byte to client, to indicate the
file is done receiving
-Check for another message, and act on that.
My problem is that this happens:
Code:
Client-side:
-send a file
-recv() 1 byte, everything's ok
-send another message to the server
-wait forever (literally) for the server to send the listing
Server-side:
-receive a file
-send() 1 byte to the client
-wait forever (literally) for the client to send another message
Somehow, it seems that the second command the client sends (get the directory listing) gets eaten somewhere along the line, and the server never receives it. But strangely enough, when I put a Sleep(500) between getting the receive confirmation and sending the second message, the second message gets sent fine. Does anybody have any clue why or what's wrong? (the code is exactly the same in both cases except for an added Sleep) :confused: