Hi,
I've got a general question about the recv-function of winsock. I write a programm with a client/server-architecture where the client sends a camera image to the server and the server sends another image back to the client. The client sends serveral images until the program is closed. And the server will responds every received image with an other image.
Client (send) ----> Server (receive) ----> Server (send) ----> Client (receive) . ^______________LOOP_____________________________|
My problem is the servers receive function. If I call the receive function serveral times with a 512Byte large buffer, how do I know that I received the whole image? The examples I found just wait until the connection is closed (recv returns 0), but I want to receive serveral images without closing the connection. But if I receive until there aren't any bytes left in the buffer, the recv function will halt the thread until there are new bytes (but this will never happen because the server first want to send its own image back to the client before receiving the next one).
So is there any possibility to tell the server that the whole image was received so that it can send its own image back to the client without waiting for the next bytes or a closed connection?
I hope my question is clear
Thanks Ben