×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Oct 2003
    Location
    Portland, OR
    Posts
    152

    killing http connection

    Hi,

    I have an app that sends an HTTP request to a server. The server holds the connection open until some data is received from a remote device. The connection can be held open for up to 30 seconds. However, the user can choose to do something else during those 30 seconds. And if that happens, the HTTP connection needs to be closed.

    How can I kill an active http connection from a different thread?

    Any help would be appreciated.

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    32
    Well, you could send the

    Connection: Close

    string during the transmission. This should force the server to close the connection.

  3. #3
    Regular Contributor
    Join Date
    Oct 2003
    Location
    Portland, OR
    Posts
    152
    How do I do that?

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    32
    is.setRequestProperty("Connection", "Close");

    ... "is" is your previously opened inputstream.

Posting Permissions

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