I have recently joined this forum.
This is my first query here:
I have developing a client server application where the server is an MFC dialog based application & the client is an MFC SDI application.
Winsock2 is being used for communication.
Both the client & the server is set to asynchronous mode by using the WSAAsyncselect().
I have 2 questions to ask:
Is a single recv() in response to a single FD_READ message appropriate OR the
recv() must be called in a loop untill all data is received.
Lets say the server needs to send 1000 bytes of data to the client but at a time
only 100 bytes.
Now there are two ways:
1----> The server calls send() in a loop & donot cares whether data reaches the client or not.
2----> The server calls send() in a loop & after every send() it waits for the client's
notification that the data is received, now send next lot of 100 bytes.
Waiting for suggestions