tcp 状态机

A connection progresses through a series of states during its lifetime.

The states are:

  • LISTEN,
  • SYN-SENT,
  • SYN-RECEIVED,
  • ESTABLISHED,
  • FIN-WAIT-1,
  • FIN-WAIT-2,
  • CLOSE-WAIT,
  • CLOSING,
  • LAST-ACK,
  • TIME-WAIT,
  • CLOSED.

CLOSED is fictional because it represents the state when there is no TCB, and therefore, no connection.

Briefly the meanings of the states are:

  • LISTEN : represents waiting for a connection request from any remote TCP and port.

  • SYN-SENT : represents waiting for a matching connection request after having sent a connection request.

  • SYN-RECEIVED : represents waiting for a confirming connection request acknowledgment after having both received and sent a connection request.

  • ESTABLISHED : represents an open connection, data received can be delivered to the user. The normal state for the data transfer phase of the connection.

  • FIN-WAIT-1 : represents waiting for a connection termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent.

  • FIN-WAIT-2 : represents waiting for a connection termination request from the remote TCP.

  • CLOSE-WAIT : represents waiting for a connection termination request from the local user(app).

  • CLOSING : represents waiting for a connection termination request acknowledgment from the remote TCP.

  • LAST-ACK : represents waiting for an acknowledgment of the connection termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request).

  • TIME-WAIT : represents waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request.

  • CLOSED : represents no connection state at all.

A TCP connection progresses from one state to another in response to events.

The events are the user calls, OPEN, SEND, RECEIVE, CLOSE, ABORT, and STATUS; the incoming segments, particularly those containing the SYN, ACK, RST and FIN flags; and timeouts.

相关推荐
GetcharZp1 小时前
GitHub 49K+ Star!C++ 开发者必知的 JSON 神级库:从零到精通全指北
后端
xujinwei_gingko1 小时前
SpringBoot整合WebSocket
spring boot·后端·websocket
智码看视界2 小时前
现代Web开发基础:全栈工程师的起航点
前端·后端·c5全栈
程序员cxuan2 小时前
Claude Fable 5 来了
人工智能·后端·程序员
JS菌2 小时前
手写一个 AI Agent 全栈项目:从沙箱执行到子智能体的完整实现
前端·人工智能·后端
wang09072 小时前
自己动手写一个spring之IOC_2
java·后端·spring
ltl3 小时前
推理退化:为什么大模型会输出乱码、死循环和无意义文本
后端
ltl3 小时前
架构视图与文档:C4 模型从入门到实战
后端
IT_陈寒6 小时前
Redis持久化这个坑,我爬了一整天才出来
前端·人工智能·后端
无风听海6 小时前
多租户系统中的 OIDC:Discovery 端点与联合登录的深度实践
后端·python·flask