C#通过http协议_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > C#通过http协议

C#通过http协议

 2012/2/16 9:10:50  隗合山  程序员俱乐部  我要评论(0)
  • 摘要:StreamReaderdin=File.OpenText("url_ys.txt");str=din.ReadLine();din.Close();//设置打开页面的参数Stringurl=http://127.0.0.1:8060/myjob;HttpWebRequestrequest=WebRequest.Create(url)asHttpWebRequest;request.Method="GET";request.KeepAlive=false;request
  • 标签:C# 协议 HTTP

?? StreamReader din = File.OpenText("url_ys.txt");???????????????

????????????? str = din.ReadLine();
??????????????? din.Close();

??????????????? // 设置打开页面的参数
??????????????? String url = http://127.0.0.1:8060/myjob;
??????????????? HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
??????????????? request.Method = "GET";
??????????????? request.KeepAlive = false;
??????????????? request.Timeout = 5000;

??????????????? // 接收返回的页面
??????????????? HttpWebResponse response = request.GetResponse() as HttpWebResponse;
??????????????? System.IO.Stream responseStream = response.GetResponseStream();
??????????????? System.IO.StreamReader reader = new System.IO.StreamReader(responseStream, Encoding.Default);
??????????????? String srcString = reader.ReadToEnd();

?

??????????????? reader.Close();
??????????????? response.Close();

??????????????? UI ui = new UI(srcString);

??????????????? reader.Close();
??????????????? response.Close();

发表评论
用户名: 匿名