Hello guys.
I have created a Win32 server-client application, where many clients connect to server, send query and recv response. It works fine in many installations, But the connection is closed in some others. Both client and server report that the connection is closed by the remote host. The sequence of socket operations after the connection is created is this:
Client: sends query Q1 (by calling send)
Server: recvs query Q1 and sends R1
Client: recvs R1
Client: sends query Q2
Server: recvs query Q2 and sends R2
Client: recvs R2
and so on
In some networks, after a period of time, for example, 1 hour or 10 minutes,
Client Sends Q(n) successfully
Server recvs SOCKET_ERROR. (WSA error 10054) and my code exits thread, deleting client. //unexpected
Client recvs SOCKET_ERROR. (WSA error 10054)
Both server and clients are alive and log all activities, Including WSAGetLastError results
In server there is one thread for each client. server has negligible delay before responding.
Why the function recv() at server returns SOCKET_ERROR? Who closes the socket? any links or suggestions appreciated.
mr.abzadeh