FIN omitted, FIN-ACK sent
STACKOVER ADDRESS:https://stackoverflow.com/questions/21390479/fin-omitted-fin-ack-sent
question:
As it's written on Wikipedia closing TCP connection should be using packets FIN->(FIN,ACK)->ACK. However when I use close() function to close socket I don't see FIN packet, there is instantly sent (FIN,ACK) packet from server to client, then client closes also connection by sending (FIN,ACK) and server responds with ACK packet. So where is the missing FIN packet (maybe it's merged to FIN,ACK)?
answer:
The closing sequence can also be different and don't need to have FIN+ACK inside the same packet:
- ACK just acknowledges the receipt of data (e.g. received everything up to given sequence number)
- packets will be re-send until one receives an ACK for them
- FIN just says that the side sending the FIN will not send any more data. It gives no information if it will still receive data.
- like every other packet FIN will be re-send until the receipt is acknowledged
Protocols like HTTP support a one-sided shutdown, e.g. the client sends the request data followed by a FIN to notify the server, that it will not send anymore data. But it will still receive the data send by the server. The server will acknowledge the FIN like it did with all the data before. Once the server is done it will send its own FIN which the client ACKs. In this case you have
. client: FIN (will not send more)
. server: ACK (received the FIN)
.. server: sends more data..., client ACKs these data
. server: FIN (will not send more)
. client: ACK (received the FIN)
Note that the packet you see in step#1 might have an ACK inside too. But this ACK just acknowledges data send before by the server. If the server has no more data to send it might close the connection also. In this case steps 2+3 can be merged, e.g. the server sends a FIN+ACK, where the ACK acknowledges the FIN received by the client.
If one side sends its FIN the connection is called half-closed. It is fully closed once both sides send their FIN and received the ACK for the FIN, no matter if they do this in 3 or 4 packets.
FIN omitted, FIN-ACK sent的更多相关文章
- TCP状态机:当服务端主动发FIN进TIME_WAIT,客户端源端口复用会发生什么
0X01 正常情况下TCP连接会通过4次挥手进行拆链(也有通过RST拆除连接的可能,见为什么服务器突然回复RST--小心网络中的安全设备),下图TCP状态机展示了TCP连接的状态变化过程: 我们重点看 ...
- tcp 接收被动关闭 fin
void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, const struct tcphdr *th, unsigned int ...
- 浅谈iptables 入站 出站以及NAT实例
--------------本文是自己工作上的笔记总结,适合的可以直接拿去用,不适合的,适当修改即可!--------------- iptbales默认ACCEPT策略,也称通策略,这种情况下可以做 ...
- TCP三次握手/四次挥手详解
一. TCP/IP协议族 TCP/IP是一个协议族,通常分不同层次进行开发,每个层次负责不同的通信功能.包含以下四个层次: 1. 链路层,也称作数据链路层或者网络接口层,通常包括操作系统中的设备驱动程 ...
- TCP十一种状态
2.全部11种状态 2.1.客户端独有的:(1)SYN_SENT (2)FIN_WAIT1 (3)FIN_WAIT2 (4)CLOSING (5)TIME_WAIT . 2.2.服务器独有的:(1)L ...
- TCP/IP是一种十一状态
1.建立连接协议(三次握手) 三次握手过程说明: 1. 在最开始,客户端和服务器都是处于CLOSED状态 2.服务器会创建sockert开始监听,服务器状态LISTEN 3.客户端向服务器端发送SY ...
- 简析TCP的三次握手与四次分手
TCP是什么? 具体的关于TCP是什么,我不打算详细的说了:当你看到这篇文章时,我想你也知道TCP的概念了,想要更深入的了解TCP的工作,我们就继续.它只是一个超级麻烦的协议,而它又是互联网的基础,也 ...
- TCP的三次握手(建立连接)和四次挥手(关闭连接)
参照: http://course.ccniit.com/CSTD/Linux/reference/files/018.PDF http://hi.baidu.com/raycomer/item/94 ...
- 转载请注明出处: https://github.com/qiu-deqing/FE-interview
转载请注明出处: https://github.com/qiu-deqing/FE-interview Table of Contents generated with DocToc FE-inter ...
随机推荐
- centos7/linux 磁盘管理入门
添加新磁盘并挂载: 设置虚拟机系统里添加磁盘,重启虚拟机后,虚拟机目录/dev下会增加一个sdb设备. 使用fdisk /dev/sdb 管理磁盘分区,首先p 查看磁盘分区信息,然后n增加一个主分区, ...
- 01Hadoop简介
Hadoop思想之源:Google 面对的数据和计算难题 ——大量的网页怎么存储 ——搜索算法 带给我们的关键技术和思想(Google三篇论文) ——GFS(hdfs) ——Map-Reduce —— ...
- ADB连接手机的两种方式(usb数据线连接和wifi连接)
ADB(Android Debug Bridge)安卓测试桥,它是连接电脑开发端和安卓设备的桥梁,这个安卓设备可以是真实的安卓手机或者平板,也可以是虚拟的安卓模拟器, 这里介绍ADB连接手机的两种 ...
- JCP与JSR
JCP Java Community Process ,Java社区进程,Java标准指定组织JCP成立于1998年,官网,由社会各界Java组成的社区,规划和领导Java的发展,其成员可以在这里看到 ...
- express 与 koa 区别
express 与 koa 区别 区别项 express koa 中间件模型 Compress 模型 洋葱圈模型 对象个数 只有2个对象:Request 和 Response 有3个对象:Reques ...
- thinkphp本地调用Redis队列任务
1.安装配置好Redis 2.进入项目根目录文件夹输入cmd进入命令行 3.输入php think 查看php扩展 4.输入 php think queue:listen 启动队列监听
- PyCharm 设置Python 文件头部模板
1. 菜单栏-> File -> Settings -> Editor -> File and Code Templates ->Python Script 2.配置头文 ...
- 利用Jmeter批量数据库插入数据
1. 启动Jmeter 2. 添加 DBC Connection Configuration 右键线程组->添加->配置元件->JDBC Connection Configu ...
- golang 自定义json解析
在实际开发中,经常会遇到需要定制json编解码的情况. 比如,按照指定的格式输出json字符串, 又比如,根据条件决定是否在最后的json字符串中显示或者不显示某些字段. 如果希望自己定义对象的编码和 ...
- Flume 案例 Telnet安装及采集Telnet发送信息到控制台
Telnet安装 一.查看本机是否安装telnet #rpm -qa | grep telnet 如果什么都不显示.说明你没有安装telnet 二.开始安装 yum install xinetd yu ...