有一个多线程程序需要异步向指定IP发送文件流。
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(URI);
httpRequest.Method = "POST";
httpRequest.Timeout = 30 * 1000;
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] buffer = encoding.GetBytes(protocolContent);//protocolContent是需要发送的内容
httpRequest.ContentLength = (long)buffer.Length;
// 以上执行都没问题,但是下面的程序在执行几个线程后就不执行了,直到超时
using (Stream stream = httpRequest.GetRequestStream())
{
    stream.Write(buffer, 0, buffer.Length);
}
HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();if (httpResponse.StatusCode == HttpStatusCode.OK)
{
//......
}
请教高人指点。