Results 1 to 4 of 4

Thread: Server side connection info

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    15

    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?

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Server side connection info

    If a connection is dropped how would your program be sending data?

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    15

    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.
    Last edited by Mike Trader; Apr 7th, 2008 at 08:06 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width