在线等 要向网页提交大量数据,但是我写的执行效率太慢,前两次还可以,但是第三次就不能执行了
在线等 要向网页提交大量数据,但是我写的执行效率太慢,前两次还可以,但是第三次就不能执行了
代码如下
private void SendMsg(string sendMsg,string PostUrl)
{
Encoding encode = System.Text.Encoding.GetEncoding("gb2312");
byte[] arrB = encode.GetBytes(sendMsg)
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(PostUrl);
myReq.Method = "POST";
myReq.ContentType = "application/x-www-form-urlencoded";
myReq.ContentLength = arrB.Length;
Stream outStream = myReq.GetRequestStream(); //执行到这一步就卡住了
outStream.Write(arrB, 0, arrB.Length);
outStream.Close();
outStream.Dispose();
}
我是用timer组件实现循环的,但是老师卡住,望高手指点~
没有多少分了,但是尽量多给~