Is there any event that is fired when the idHttpServer disconnects?
By disconnect I dont mean when a client disconnects, but when the idHTTPServer disconnect for some reason.
I can explain it better: when idHTTPServeris listening to a socket port and, for some unknown reason, the computer disconnects from the network (lets say, for example, that the the network becomes unavailable) the component does not work anymore (it stops listening to the port) and, in that case, I need to reconnect (reopen the port). The idHttpServer.OnDisconnect, according to the help, is only fired when a client disconnects from the server.
I have two suggestions to help you solve your issue.
First of all, add a timer where once every minute (or interval of your choice), “ask” windows if your port is still listening or not. This must be done outside of Indy, as Indy has no mechanism to do this. If Windows tells you this port is not listening, then record this to a log and restart your server. Check this log periodically to see if your app has ever reported your port to stop listening. This will tell you if it really is disconnecting or not.
Second of all, you might want to consider a nightly restart of your server socket. For example, at midnight every night, stop and start the server socket to ensure a fresh connection. There might be some variable overflow, for example, if you are constantly incrementing a number and it keeps getting larger and larger, then over time, that number will become too large for your application to hold it. This can happen anywhere between 5 seconds or 5 months of run-time, depending on how fast you increment it.