private void bt_connectAllPile_Click(object sender, EventArgs e) { foreach (ListViewItem tempLvt in lv_pipeList.Items) { PipeHttp tempPh = (PipeHttp)tempLvt.Tag; //tempPh.IsReportResponse = cb_isRecieve.Checked; if (tempPh.Connect()) { //tempLvt.BackColor = Color.LightGreen; //lv_pipeList.Update(); } else { ReportMyMessage(string.Format("ID:[{0}] connect fail", tempPh.Id.ToString())); } } }
private void PipeHttpRuner_Load(object sender, EventArgs e) { pipeList = new List <PipeHttp>(); return; PipeHttp.GlobalRawRequest.ConnectHost = "www.baidu.com"; PipeHttp.GlobalRawRequest.StartLine = "GET http://www.baidu.com/ HTTP/1.1"; PipeHttp.GlobalRawRequest.Headers.Add("Content-Type: application/x-www-form-urlencoded"); PipeHttp.GlobalRawRequest.Headers.Add(string.Format("Host: {0}", PipeHttp.GlobalRawRequest.ConnectHost)); PipeHttp.GlobalRawRequest.Headers.Add("Connection: Keep-Alive"); PipeHttp.GlobalRawRequest.CreateRawData(); PipeHttp ph = new PipeHttp(100, true); ph.pipeRequest = PipeHttp.GlobalRawRequest; ph.OnPipeResponseReport += ph_OnPipeResponseReport; ph.OnPipeInfoReport += ph_OnPipeInfoReport; ph.Connect(); ph.Send(100); }