标签:序列号 time 添加 keep ida 窗口 收缩 发送 using
TCP 特征 没有选择确认或否认的滑动窗口协议 长连接:三次握手、四次挥手 可靠性:保证数据确实到达目的地,如果未到达,能够发现并重传 数据排序:序列号,累积确认 数据流控:拥塞控制 滑动窗口与拥塞控制 滑动窗口 通告窗口:接收方通告给发送放,涉及累积确认 窗口移动 窗口合拢 窗口张开 窗口收缩(不推荐实现) 拥塞窗口 cwnd ssthresh Slow Start threshold 其初始值在RFC中没有明确定义,可以为任意大的值,在实现时一般初始化为rwnd 当cwnd < ssthresh时,TCP保持在Slow Start阶段 当cwnd >= ssthresh时,TCP进入Congestion Avoidance阶段 慢启动 首先设置cwnd=1,接着cwnd会随着时间的推进呈指数级增加 当cwnd达到ssthresh时,此时TCP会进入Congestion Avoidance阶段 拥塞控制 在此阶段,cwnd不再像Slow Start那样指数级增长,而是线性增长 超时:重传未被响应的packet,并将ssthresh设置为cwnd/2,并将cwnd重置为1,然后重新进入Slow Start阶段 3个重复ACK:会先进行Fast Retransmit,然后进入Fast Recovery阶段 Fast Retransmit 只要收到3个重复ACK,即认为丢包发生,此时会立即重传丢失的包,而不再等待超时的出现 3个ACK是经验性结论 TCP规定当接收到一个时序的报文段时,必须立即发送一个重复的ACK Fast Recovery 1. 将ssthresh设置为cwnd/2,cwnd=ssthresh+3,不是将cwnd重置为1 2. 每次收到重复ACK,cwnd++ 3. 下一个新ACK到达后,cwnd=ssthresh https://blog.csdn.net/sicofield/article/details/9708383 http://www.cnblogs.com/zszmhd/p/3623155.html http://blog.csdn.net/fengqiaojiangshui/article/details/45176847 keep-alive tcp_keepalive_time tcp_keepalive_intvl tcp_keepalive_probes 当tcp发现有tcp_keepalive_time(7200)秒未收到对端数据后,开始以间隔tcp_keepalive_intvl(75)秒的频率发送的空心跳包,如果连续tcp_keepalive_probes(9)次以上未响应代码对端已经down了,close连接 http://hengyunabc.github.io/why-we-need-heartbeat/ http://www.cnblogs.com/0201zcr/p/4694945.html https://imququ.com/post/transfer-encoding-header-in-http.html TCP状态 CLOSED: The socket is not in use. LISTEN: The socket is listening for incoming connections. Unconnected listening sockets like these are only displayed when using the -a option. SYN_SENT: The socket is actively trying to establish a connection to a remote peer. SYN_RCVD: The socket has passively received a connection request from a remote peer. ESTABLISHED: The socket has an established connection between a local application and a remote peer. CLOSE_WAIT: The socket connection has been closed by the remote peer, and the system is waiting for the local application to close its half of the connection. LAST_ACK: The socket connection has been closed by the remote peer, the local application has closed its half of the connection, and the system is waiting for the remote peer to acknowledge the close. FIN_WAIT_1: The socket connection has been closed by the local application, the remote peer has not yet acknowledged the close, and the system is waiting for it to close its half of the connection. FIN_WAIT_2: The socket connection has been closed by the local application, the remote peer has acknowledged the close, and the system is waiting for it to close its half of the connection. CLOSING: The socket connection has been closed by the local application and the remote peer simultaneously, and the remote peer has not yet acknowledged the close attempt of the local application. TIME_WAIT: The socket connection has been closed by the local application, the remote peer has closed its half of the connection, and the system is waiting to be sure that the remote peer received the last acknowledgement. 作用: 1. 可靠地实现TCP全双工连接的终止 2. 允许老的重复分节在网络中消逝 大量TIME_WAIT修复 https://blog.csdn.net/yanggd1987/article/details/39317871 状态与socket函数 服务器调用listen进行监听 客户端调用connect来发送syn报文 服务器协议栈负责三次握手的交互过程。连接建立后,往listen队列中添加一个成功的连接,直到队列的最大长度 服务器调用accept从listen队列中取出一条成功的tcp连接,listen队列中的连接个数就少一个 accept与三次握手无关 https://blog.csdn.net/u013782203/article/details/51767763 https://blog.csdn.net/futurewu/article/details/76674016
标签:序列号 time 添加 keep ida 窗口 收缩 发送 using
原文地址:https://www.cnblogs.com/shaellancelot/p/9021830.html