Server side connection info
Can a CGI.exe alert an app to a connection drop?
Lets say a client app uses HTTP to request a large file and the client's connection gets dropped.
The CGI.exe has received the request and has begun returning the file. I don't want to tie up the server for one second longer that necessary pumping data out into the ether, so is there a way to detect the loss of connection in a CGI.exe?
Re: Server side connection info
If a connection is dropped how would your program be sending data?
Re: Server side connection info
If you are using HTTP/1.1 then the HTTP response from the server will have accompanied a Content-Length header. Additionally you may want to include a hash at the beginning on the communication to use later and verify the file.
Checking weather the connection was alive long enough for the transfer to complete is simply a case of comparing the content-length with the length of data received.
Re: Server side connection info
Yes, I didn't explain this very well.
Lets say client initiates a 1.1 async connection with a request for a lot of data then almost immediately looses its connection. The server will be busy tying up resources for a while responding to the request, compiling data chewing through it and sending it to a client that long since disappeared.
At peak times these resources could be used to serve another client so detecting the loss of connection immediately becomes important to kill the server side process.
On the client side detecting a loss of connection is not an issue, its the server side.
I could implement a schema that requires an Ack from the client and if not received in a certain timeout, then the server assumes the connection is dead, but I was hoping for something like a notification in a callback style message somehow.