標籤:
1. 準備代碼
// Creates an HttpWebRequest with the specified URL. HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("http://10.2.37.231:8080/marketcouponh5/api/bjjson/getPromotionActivity");//myHttpWebRequest.Proxy = new WebProxy("localhost", 5389);// Sends the HttpWebRequest and waits for the response. myHttpWebRequest.KeepAlive = true;HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();// Gets the stream associated with the response.Stream receiveStream = myHttpWebResponse.GetResponseStream();Encoding encode = System.Text.Encoding.GetEncoding("utf-8");// Pipes the stream to a higher level stream reader with the required encoding format. StreamReader readStream = new StreamReader(receiveStream, encode);Console.WriteLine("\r\nResponse stream received.");Char[] read = new Char[256];// Reads 256 characters at a time. int count = readStream.Read(read, 0, 256);Console.WriteLine("HTML...\r\n");while (count > 0){// Dumps the 256 characters on a string and displays the string to the console.String str = new String(read, 0, count);Console.Write(str);count = readStream.Read(read, 0, 256);}// Releases the resources of the response.//myHttpWebResponse.Close();// Releases the resources of the Stream.//readStream.Close();
2. wireshark(wireshar過濾 條件:(ip.src ==10.32.42.160 and ip.dst==10.2.37.231) or (ip.src ==10.2.37.231 and ip.dst==10.32.42.160))
3. 分析
本 服 syn
服本syn ack
本服ack
-----------已經建立好串連
本服http post
服本ack
服本tcp segment
服本tcp segment
服本tcp segment
本服ack
服本http-alt ack
服本tcp segment
服本http response
本服http-alt ack
-----------資料已經傳輸好了,標準的四次揮手過程
服本fin ack
本服http-alt ack
本服http-alt fin ack
服本http-alt ack
http 三向交握 四次揮手 wireshark