G
Guest
The following code being repeated in a loop sends keep-alive at frst
iteration only.
So I quickly run out of ports (all are in time_wait state)
Why?
// create the web request to get the remote stream
HttpWebRequest requestToCrk = (HttpWebRequest)WebRequest.Create( url );
requestToCrk.Method = "POST";
requestToCrk.KeepAlive = true;
requestToCrk.ContentType = "application/octet-stream";
requestToCrk.ContentLength = buff.Length;
Stream sendStream = requestToCrk.GetRequestStream();
sendStream.Write(buff, 0, bytes ); // real writing to web server !!!
sendStream.Close();
HttpWebResponse responseFromCrk;
try
{
responseFromCrk = (HttpWebResponse)requestToCrk.GetResponse();
StreamReader sr = new StreamReader(
responseFromCrk.GetResponseStream() );
responseBody = sr.ReadToEnd();
}
catch(System.Net.WebException we)
{
ProcessError( we, "pbviews connection manager is not running." );
return;
}
iteration only.
So I quickly run out of ports (all are in time_wait state)
Why?
// create the web request to get the remote stream
HttpWebRequest requestToCrk = (HttpWebRequest)WebRequest.Create( url );
requestToCrk.Method = "POST";
requestToCrk.KeepAlive = true;
requestToCrk.ContentType = "application/octet-stream";
requestToCrk.ContentLength = buff.Length;
Stream sendStream = requestToCrk.GetRequestStream();
sendStream.Write(buff, 0, bytes ); // real writing to web server !!!
sendStream.Close();
HttpWebResponse responseFromCrk;
try
{
responseFromCrk = (HttpWebResponse)requestToCrk.GetResponse();
StreamReader sr = new StreamReader(
responseFromCrk.GetResponseStream() );
responseBody = sr.ReadToEnd();
}
catch(System.Net.WebException we)
{
ProcessError( we, "pbviews connection manager is not running." );
return;
}