I have an application that simultaneously connects to many websites and uploads large files via http.
When I test the system with TcpView, CLOSE_WAITthere are many connections in the state . My code looks something like this:
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
}
catch
{
if (response != null)
response.Close();
}
Stream stream = Response.GetResponseStream();
// read stream until an error happens or we reach end of stream. Then:
if (request != null)
request.Abort();
if (response != null)
response.Close();
Why am I still able to make many connections CLOSE_WAIT?
source
share