設為首頁收藏本站

Hippies

 找回密碼
 立即註冊

掃一掃,訪問微社區

搜索
熱搜: 活動 交友 discuz
查看: 6117|回復: 0
打印 上一主題 下一主題

[Forward]TCP Socket Flow description

[複製鏈接]
  • TA的每日心情
    開心
    2016-2-27 23:29
  • 簽到天數: 27 天

    [LV.4]偶爾看看III

    438

    主題

    611

    帖子

    705

    積分

    高級會員

    Rank: 4

    積分
    705
    跳轉到指定樓層
    樓主
    發表於 2015-11-25 18:22:28 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式 简体中文繁體中文
    本帖最後由 kevinhu 於 2015-11-25 18:23 編輯

    Let me elaborate. Transmission Control Protocol (TCP) is designed to be a bidirectional, ordered, and reliable data transmission protocol between two end points (programs). In this context, the term reliable means that it will retransmit the packets if it gets lost in the middle. TCP guarantees the reliability by sending back Acknowledgment (ACK) packets back for a single or a range of packets received from the peer.
    This goes same for the control signals such as termination request/response. RFC 793 defines the TIME-WAIT state to be as follows:
      TIME-WAIT - represents waiting for  enough time to pass to be sure      the remote TCP received the acknowledgment of its connection      termination request.
    See the following TCP state diagram:
    TCP is a bidirectional communication protocol, so when the connection is established, there is not a difference between the client and the server. Also, either one can call quits, and both peers needs to agree on closing to fully close an established TCP connection.
    Let's call the first one to call the quits as the active closer, and the other peer the passive closer. When the active closer sends FIN, the state goes to FIN-WAIT-1. Then it receives an ACK for the sent FIN and the state goes to FIN-WAIT-2. Once it receives FIN also from the passive closer, the active closer sends the ACK to the FIN and the state goes to TIME-WAIT. In case the passive closer did not received the ACK to the second FIN, it will retransmit the FIN packet.
    RFC 793 sets the TIME-OUT to be twice the Maximum Segment Lifetime, or 2MSL. Since MSL, the maximum time a packet can wander around Internet, is set to 2 minutes, 2MSL is 4 minutes.Since there is no ACK to an ACK, the active closer can't do anything but to wait 4 minutes if it adheres to the TCP/IP protocol correctly, just in case the passive sender has not received the ACK to its FIN (theoretically).
    In reality, missing packets are probably rare, and very rare if it's all happening within the LAN or within a single machine.

    [發帖際遇]: kevinhu 樂于助人,獎勵 5 貢獻. 幸運榜 / 衰神榜
    最近訪問 頭像模式 列表模式
    您需要登錄後才可以回帖 登錄 | 立即註冊

    本版積分規則

    小黑屋|手機版|Archiver|Hippies 手作皮革工作坊  

    GMT+8, 2024-12-22 17:02 , Processed in 0.104087 second(s), 16 queries , Apc On.

    Powered by Discuz! X3.2

    © 2001-2013 Comsenz Inc.

    快速回復 返回頂部 返回列表