2

I am using HttpWebRequest to connect to a URL. This url keeps the connection open so that it can pump the data to the client over the internet. A custom pub/sub if you will.

It is a simple GET.

The response headers I get looks something like this:

HTTP/1.1 200 OK
Connection: close
Date: Tue, 09 Nov 2010 23:02:11 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Transfer-Encoding: chunked
Cache-Control: private
Content-Type: text/html; charset=utf-8

Anyway, when I call HttpWebResponse.Close() on the client, the call hangs indefinitely. I do get disconnected but only when the server aborts the connection.

I tried various settings on the request object and ServicePoint, etc. with little luck.

Any idea how I can close these connections from the client side without getting hung?

Jiho Han
  • 1,610
  • 1
  • 19
  • 41

1 Answers1

0

Try calling .Abort() on the HttpWebRequest object just prior to calling .Close() on the HttpWebResponse.

cdhowie
  • 158,093
  • 24
  • 286
  • 300