Exploring TCP state machine by graphs
States
TCP includes 11 states, they are:
LISTEN
SYN_SENT
SYN_RECV
ESTABLISHED
FIN_WAIT1
CLOSE_WAIT
FIN_WAIT2
LAST_ACK
TIME_WAIT
CLOSED
CLOSING
@include/net/tcp_states.h:
/* Definitions for the TCP protocol sk_state field. */ #ifndef _LINUX_TCP_STATES_H
#define _LINUX_TCP_STATES_H enum {
TCP_ESTABLISHED = 1,
TCP_SYN_SENT,
TCP_SYN_RECV,
TCP_FIN_WAIT1,
TCP_FIN_WAIT2,
TCP_TIME_WAIT,
TCP_CLOSE,
TCP_CLOSE_WAIT,
TCP_LAST_ACK,
TCP_LISTEN,
TCP_CLOSING, /* Now a valid state */ TCP_MAX_STATES /* leave at the end! */
}; #define TCP_STATE_MASK 0xF
#define TCP_ACTION_FIN (1 << 7) enum {
TCPF_ESTABLISHED = (1 << 1),
TCPF_SYN_SENT = (1 << 2),
TCPF_SYN_RECV = (1 << 3),
TCPF_FIN_WAIT1 = (1 << 4),
TCPF_FIN_WAIT2 = (1 << 5),
TCPF_TIME_WAIT = (1 << 6),
TCPF_CLOSE = (1 << 7),
TCP_CLOSE_WAIT = (1 << 8),
TCP_LAST_ACK = (1 << 9),
TCP_LISTEN = (1 << 10),
TCP_CLOSING = (1 << 11)
}; #endif /* _LINUX_TCP_STATES_H */
View of Server
Passive open and passive close often performed by Server, the normal routine is illustrated as follow.
I denote the passive open/close transitions with a blue line (normal transitions are in bold).
View of Client
Ative open and Active close often performed by Client, the normal routine is illustrated as follow.
I denote the active open/close transitions with a green line (normal transitions are in bold).
As a whole
We know while most TCP state transitions are normal, it also has some unnormal transitions, including:
simultaneous open
simultaneous close
RST and etc.
I use dashed line to denote this kind of transitions.
Sequence chart
(1)Normal sequence chart (including active open/close, passive open/close)
(2)simultaneous open
(3)simultaneous close
Author
zhangskd @ csdn blog
Exploring TCP state machine by graphs的更多相关文章
- Qt: The State Machine Framework 学习
State Machine,即为状态机,是Qt中一项非常好的框架.State Machine包括State以及State间的Transition,构成状态和状态转移.通过状态机,我们可以很方便地实现很 ...
- 证明与计算(7): 有限状态机(Finite State Machine)
什么是有限状态机(Finite State Machine)? 什么是确定性有限状态机(deterministic finite automaton, DFA )? 什么是非确定性有限状态机(nond ...
- Finite State Machine 是什么?
状态机(Finite State Machine):状态机由状态寄存器和组合逻辑电路构成,能够根据控制信号按照预先设定的状态进行状态转移,是协调相关信号动 作.完成特定操作的控制中心. 类 ...
- State Machine.(状态机)
What is a State Machine? Any device that changes its state from one to another due to some actions a ...
- Finite State Machine
Contents [hide] 1 Description 2 Components 3 C# - FSMSystem.cs 4 Example Description This is a Dete ...
- Android4.0中蓝牙适配器state machine(状态机)的分析
今天晓东和大家来一起看一下Android4.0中蓝牙适配器(Bluetooth Adapter)的状态机变化的过程.首先,我们需要了解一下,蓝牙适配器究竟有哪些状态,从代码可以清晰地看到(framew ...
- 控制结构(3) 状态机(state machine)
// 上一篇:卫语句(guard clause) // 下一篇:局部化(localization) 基于语言提供的基本控制结构,更好地组织和表达程序,需要良好的控制结构. 前情回顾 上次分析了guar ...
- UNIX网络编程——SOCKET API和TCP STATE的对应关系_三次握手_四次挥手及TCP延迟确认
在socket系统调用中,如何完成三次握手和四次挥手: SOCK_DGRAM即UDP中的connect操作知识在内核中注册对方机器的IP和PORT信息,并没有建立连接的过程,即没有发包,close也不 ...
- 控制结构(3): 状态机(state machine)
// 上一篇:卫语句(guard clause) // 下一篇:局部化(localization) 基于语言提供的基本控制结构,更好地组织和表达程序,需要良好的控制结构. 前情回顾 上次分析了guar ...
随机推荐
- openssl 对称加密算法enc命令详解
1.对称加密算法概述 openssl的加密算法库提供了丰富的对称加密算法,我们可以通过openssl提供的对称加密算法指令的方式使用,也可以通过调用openssl提供的API的方式使用. openss ...
- WEB服务器5--IIS中ISAPI扩展、ISAPI筛选器
在IIS的文档中经常会提到两个术语:ISAPI扩展和ISAPI筛选器. ISAPI扩展 “ISAPI扩展(ISAPI Extension)”是一种可以添加到IIS中以增强Web服务器功能的程序,其载体 ...
- Webstrom 使用过程中遇到的问题以及解决方案
作为一个前端开发,我用过webstorm和sublime两个编辑器.sublime小巧轻便,不耗内存.但是webstorm具有以下特点,让我难以舍弃. webstorm优点 点击一个函数名,它会跳到函 ...
- ListView加载两种以上不同的布局
不同的项目布局(item layout) Listview一种单一的item 布局有时候不能完全满足业务需求,我们需要加载两种或两种以上不同的布局,实现方法很简单: 重写 getViewTypeCou ...
- Cisco cmd 命令
1.enable 开启全局配置模式:disable 禁用配置模式 2.config进入配置模式 3.line 设置进入用户模式密码:分为 line aux 0;line console 0;line ...
- mono for android工具下载
http://www.wuleba.com/25510.html Windows平台:http://xamarin.com/installer_assets/v3/Windows/Universal/ ...
- oracle用户权限的问题
一.创建用户 create user username identified by password --username 创建的用户的名称 --password 创建的用户的密码 二.赋权限 gra ...
- 使用myfocus制作焦点图
第一步:引入myfocus基本库和所要使用样式的js和css文件 <script src="js/myfocus-2.0.1.min.js"></script&g ...
- oracle 查询重复数据
SELECT * FROM td_attrval_group WHERE parent_attrval_id IN(SELECT parent_attrval_id FROM td_attrval_g ...
- CSS3动画之无缝滚动
与js的无缝滚动类似,整个承载图片的盒子移动,克隆一组图片放置最后,当一组图片播放结束后将盒子定位在有一组图片宽度的左侧 HTML结构: <div class="box"&g ...