//调用示例:
2003-7-1 【程序编程相关:设计模式之C#实现(一)--Abstra】/* 【推荐阅读:设计模式之C#实现(一)--Abstra】2.可指定同步或异步 【扩展信息:VC++.NET的寄存器al的Bug】1.支持proxy3.一些小修改*/private void button1_click(object sender, system.eventargs e) { httprequestresponse xx = new httprequestresponse(); xx.dataarrival += new dataarrivaleventhandler(xx_dataarrival); //xx.sendrequest(@"http://localhost:2080/examples/myservlets/servlet2","message=qq&desttel=13910911925&mytel=13910081138&mypwd=263996211"); xx.sendrequest(@"http://localhost","message=你好qq&desttel=13910911925&mytel=13910081138&mypwd=263996211","get",true); xx.sendrequest("http://localhost/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() + "]"); } }//========================
//class1.csusing system;
using system.net;using system.threading;using system.text;using system.io;... 下一页