I have a webserver application developed using idHttpServer. When a client connects do my webserver and, for some unknown reason, got disconnect (not a gracefully disconnect) my webserver does not get notified. I know this is the normal behavior but I need to know when the client dies.
There are a few ways of doing this. I know 2 good ways:
1 - Implement a heart beat mechanism. The client socket notifies the server that it is still alive (need some work and some code to make it works)
2 - TCP Keep Alive. This is the way I like most because it requires not too much code and work. But I got a few questions regarding this.
- Is this possible to be used with idHttpServer (for the server) and wininet functions (for the client)?
- Does that really works as expected? I mean, the server gets notfied when the client dies all the times?
- Does anyone have a sample of setting this on wininet? (I guess this must be set on the client side, right?)
- Is there a better way of notify a server that the client is dead (using indy and wininet, of course)
EDIT
I am using Delphi 2010 and last Indy10 source code from their svn.