October 20th, 2002, 12:00 AM
I have a connection reset problem with a server-client application I am developing. I have google searched but can't seem to find how I can send a keep alive to my server. My client sends a few strings to the server, the server processes the data sent, and continues to sit there waiting for more data, I get 3 strings sent then recieve a conection reset error.
Windows 98 SE is my OS. I am useing Winsock 1.1 implementation.
If someone can point me to somewhere that can explain to me the process of sending a keep alive signal to my server, as I have no idea how to do this and Cant find a solution with google.
October 20th, 2002, 10:13 AM
October 20th, 2002, 11:57 AM
It depends if you're using TCP or UDP.
If you're using UDP, you should create your own keepalive message type, and have the client send it to the server every so often (or possibly the other way around) - and have a reply. If either of them detects that the reply is missing, they should assume they've been disconnected.
But I expect you're using TCP.
over TCP you could create your own keepalive message type (if you're using it in a message-oriented way), or you could use the OS own keepalive mechanism.
This doesn't happen automatically, you have to setsockopt with SO_KEEPALIVE (not sure of exact syntax, look it up). I don't know if both ends need to do this or if just 1 end will do (probably safer to have both ends do it)
At least that's how it works on *nix - I can't imagine win98 is terribly different.
I take it this is nothing to do with "keep alive tools" which have a totally different purpose.