zoukankan      html  css  js  c++  java
  • http 三次握手 四次挥手 wireshark

    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("
    Response stream received.");
    Char[] read = new Char[256];
    // Reads 256 characters at a time. 
    int count = readStream.Read(read, 0, 256);
    Console.WriteLine("HTML...
    ");
    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

  • 相关阅读:
    智慧城市建设中政府网站群建设起到了积极的作用
    SQLite 入门教程(四)增删改查,有讲究 (转)
    基于H.264的实时网络摄像——Android客户端
    中小型数据存储方案探讨
    SQL的多表操作
    lua中的时间函数
    C++ 输入输出文件流(ifstream&ofstream)
    linux系统下的shell脚本
    makefile的简单写法
    Linux-ubuntu
  • 原文地址:https://www.cnblogs.com/wuMing-dj/p/5726278.html
Copyright © 2011-2022 走看看