I'm using THTTPClient.BeginGet() to create an async get request to a webservice that holds a connection open until it has data to return (sort of like a long-polling connection).

I'm using THTTPClient.BeginGet() to create an async get request to a webservice that holds a connection open until it has data to return (sort of like a long-polling connection).

I'm looking for a way to cancel/disconnect the waiting connection. Calling Cancel on the IAsyncResult works, but it only takes effect once the WinHttpQueryDataAvailable call in TWinHTTPResponse.DoReadData returns and says data is available (when the webservice finally returns some data).

I even tried freeing the THTTPClient which would cause it to call WinHTTPCloseHandle on the session; but that didn't work either, WinHttpQueryDataAvailable still blocks until the server has sent data; then it throws an exception saying the session was already terminated. I'm using 10.2.3 on Windows platform. Any ideas?

Comments

  1. Brian Ford In that case it looks more like a bug than a missing feature, but I doubt that different classification would have any impact on how fast will this issue be resolved.

    ReplyDelete
  2. Brian Ford BTW, you could comment on the reported issue, any additional information and use cases could not hurt.

    ReplyDelete

Post a Comment