最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
C# 刚写的 HttpRequsetResponse 类,异步、事件... 还热乎着呢!(2003-
时间:2022-07-02 12:03:02 编辑:袖梨 来源:一聚教程网
1.支持Proxy
2.可指定同步或异步
3.一些小修改
//调用示例:
private void button1_Click(object sender, System.EventArgs e)
{
HttpRequestResponse xx = new HttpRequestResponse();
xx.DataArrival += new DataArrivalEventHandler(xx_DataArrival);
//xx.SendRequest(@"http://loc*alho*s*t:2080/examples/myservlets/servlet2","message=QQ&desttel=13910911925&mytel=13910081138&mypwd=263996211");
xx.SendRequest(@"http://loc*al*ho*st","message=你好QQ&desttel=13910911925&mytel=13910081138&mypwd=263996211","GET",true);
xx.SendRequest("http://loc*al*ho*st/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/net/WebRequests/clientGETasync.src","post",false);
}
private int i=0;
private void xx_DataArrival(object sender, DataArrivalEventArgs e)
{
Console.WriteLine( i++);
Console.Write(e.RecievedData );
if (e.IsComplete)
{
Console.Write("[" + ((HttpRequestResponse) sender).Request.CookieContainer.GetCookieHeader(((HttpRequestResponse) sender).Response.ResponseUri).ToString() + "]");
2.可指定同步或异步
3.一些小修改
//调用示例:
private void button1_Click(object sender, System.EventArgs e)
{
HttpRequestResponse xx = new HttpRequestResponse();
xx.DataArrival += new DataArrivalEventHandler(xx_DataArrival);
//xx.SendRequest(@"http://loc*alho*s*t:2080/examples/myservlets/servlet2","message=QQ&desttel=13910911925&mytel=13910081138&mypwd=263996211");
xx.SendRequest(@"http://loc*al*ho*st","message=你好QQ&desttel=13910911925&mytel=13910081138&mypwd=263996211","GET",true);
xx.SendRequest("http://loc*al*ho*st/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/net/WebRequests/clientGETasync.src","post",false);
}
private int i=0;
private void xx_DataArrival(object sender, DataArrivalEventArgs e)
{
Console.WriteLine( i++);
Console.Write(e.RecievedData );
if (e.IsComplete)
{
Console.Write("[" + ((HttpRequestResponse) sender).Request.CookieContainer.GetCookieHeader(((HttpRequestResponse) sender).Response.ResponseUri).ToString() + "]");
相关文章
- jm天堂网页版官方登录入口-jm天堂网页版直接登录入口 12-14
- 蝉妈妈网页版直达入口-蝉妈妈app官方正版入口在哪 12-14
- 豆包AI智能在线网页解析神器-豆包AI智能在线会议纪要生成助手 12-14
- 小红书Web官网登录入口-小红书官方网页版一键登录 12-14
- 苍云阅读app如何快速找到目录-目录入口位置 12-14
- 苹果ID登录官网入口 - 苹果Apple ID账户登录页面一键直达 12-14