   Problem with long TCP connections
  Hi all!I'm new to this forum, and need some help. I developed an online multiplayer game, based on client-server model. The game uses TCP/IP connections, which tend to last long since one game usually lasts more than 45 minutes. The problem that I'm getting is unusually high number of disconnects (about 1 to every 15 connections).There are 2 disconnect reasons, which happen at about 50:50 rate. The first one is that server has a keepalive check, that is, every 5 seconds client sends small keepalive packet. If a server gets no keepalive packets in 60 seconds, it disconencts the client.The second reason is error from TCP/IP layer. The server uses HawkNL, and the function nlRead() returns NL_INVALID. I think this is about the same as recv() from sockets returning SOCKET_ERROR.Also, when disconencts happen there are usualy multiple clients connected to server, and only one gets disconnected, which kind of rules out server internet connection failure.The client uses SDL_net library. Client runs on windows, server on linux.Does anyone have idea what might be the cause of this? My only thought is to try to switch to reliable UDP.   
  It always helps to actually look at the error you're getting.  SOCKET_ERROR (and presumably NL_INVALID) are generic "something went wrong" errors.  To get the actual error you need to call WSAGetLastError() (windows) or check errno (linux).  That might give you some clue as to what is going on.   ;  I got the error codes. These are from HawkNL library. I got this:nlRead returns NL_INVALID: error 263: Close socketSystem error 104: Connection resetWhat I could figure out from this is that "Close socket" is some generic error again and the real error is 104: Connection reset. I searched through HawkNL code and found that identifier for this error is ECONNRESET. I tried to search more to find out what that identifier means and where is it declared, but I didn't find anything yet. I'll keep serching.If anyone has a clue what "connection reset" means, please do tell. And any other help would be highly appresiated.   ;  "Connection reset" is when the socket was closed improperly by someone. An example of a situation which might cause this is the client app crashing. Are you sure it's not the client app crashing?Presumably you have some system which sends a report back to the server when your client crashes?Another possibility would be that the client lost their internet connection, and their IP address got reassigned to someone else. Basically, it could mean almost anything. Maybe the player's machine lost power or hung.Mark   