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.

相关推荐
雨夜之寂2 小时前
mcp java实战 第一章-第一节-MCP协议简介.md
java·后端
摇滚侠2 小时前
Spring Boot 3零基础教程,WEB 开发 Thymeleaf 核心语法 笔记39
spring boot·笔记·后端·thymeleaf
Code blocks4 小时前
GB28181视频服务wvp搭建(二)
后端·音视频
码事漫谈4 小时前
C++与C#布尔类型深度解析:从语言设计到跨平台互操作
后端
程序新视界4 小时前
在MySQL中,一条SQL语句的执行全流程是怎样的?
数据库·后端·mysql
lang201509284 小时前
打造专属Spring Boot Starter
java·spring boot·后端
码事漫谈5 小时前
解决Python调用C++ DLL失败的问题:extern "C"的关键作用
后端
码事漫谈5 小时前
从「能用」到「可靠」:深入探讨C++异常安全
后端
码事漫谈5 小时前
深入理解 C++ 现代类型推导:从 auto 到 decltype 与完美转发
后端
码事漫谈5 小时前
当无符号与有符号整数相遇:C++中的隐式类型转换陷阱
后端