总算明白了tcp/ip协议listen函数中backlog参数的含义
To understand the backlog argument, we must realize that for a given listening socket, the kernel maintains two queues :
要明白backlog参数的含义,我们必须明白对于一个listening socket,kernel维护者两个队列:
1.An incomplete connection queue, which contains an entry for each SYN that has arrived from a client for which the server is awaiting completion of the TCP three-way handshake. These sockets are in the SYN_RCVD state .
1.一个未完成连接的队列,此队列维护着那些已收到了客户端SYN分节信息,等待完成三路握手的连接,socket的状态是SYN_RCVD
2.A completed connection queue, which contains an entry for each client with whom the TCP three-way handshake has completed. These sockets are in the ESTABLISHED state
2.一个已完成的连接的队列,此队列包含了那些已经完成三路握手的连接,socket的状态是ESTABLISHED
The backlog argument to the listen function has historically specified the maximum value for the sum of both queues.
backlog参数历史上被定义为上面两个队列的大小之和
Berkeley-derived implementations add a fudge factor to the backlog: It is multiplied by 1.5
Berkely实现中的backlog值为上面两队列之和再乘以1.5
When a SYN arrives from a client, TCP creates a new entry on the incomplete queue and then responds with the second segment of the three-way handshake: the server's SYN with an ACK of the client's SYN (Section 2.6). This entry will remain on the incomplete queue until the third segment of the three-way handshake arrives (the client's ACK of the server's SYN), or until the entry times out. (Berkeley-derived implementations have a timeout of 75 seconds for these incomplete entries.)
当客户端的第一个SYN到达的时候,TCP会在未完成队列中增加一个新的记录然后回复给客户端三路握手中的第二个分节(服务端的SYN和针对客户端的ACK),这条记录会在未完成队列中一直存在,直到三路握手中的最后一个分节到达,或者直到超时(Berkeley时间将这个超时定义为75秒)
If the queues are full when a client SYN arrives, TCP ignores the arriving SYN (pp. 930–931 of TCPv2); it does not send an RST. This is because the condition is considered temporary, and the client TCP will retransmit its SYN, hopefully finding room on the queue in the near future. If the server TCP immediately responded with an RST, the client's connect would return an error, forcing the application to handle this condition instead of letting TCP's normal retransmission take over. Also, the client could not differentiate between an RST in response to a SYN meaning "there is no server at this port" versus "there is a server at this port but its queues are full."
如果当客户端SYN到达的时候队列已满,TCP将会忽略后续到达的SYN,但是不会给客户端发送RST信息,因为此时允许客户端重传SYN分节,如果返回错误信息,那么客户端将无法分清到底是服务端对应端口上没有相应应用程序还是服务端对应端口上队列已满这两种情况
分享到:
相关推荐
tcp协议三次握手,socket连接的参数详细协商过程,主要是对监听过程的分析
TCP三次握手和backlog参数1
调用bind函数分配IP地址和端口号 int bind(int sockfd, struct sockaddr *myaddr, socklen_t addrlen); 3. 调用listen函数转化为可接收请求状态 int listen(int sockfd, int backlog); 4. 调用accept函数受理连接...
在TCP/IP协议中,TCP协议提供可靠的连接服务,采用三次握手建立一个连接。 第一次握手:建立连接时,客户端发送syn包(syn=j)到服务器,并进入SYN_SEND状态,等待服务器确认; 第二次握手:服务器收到syn包,必须...
这段代码是 Linux 内核中负责...接下来,使用 SYSCALL_DEFINE2(listen, int, fd, int, backlog) 宏定义 syscall 接口 listen,这个接口让用户空间的程序可以调用内核中定义的 __sys_listen 函数进行 socket 监听设置。
Socket,又称套接字,在TCP/IP协议分层架构中,属应用层和传输层之间的一个抽象层(也有的说是属于传输层),它把TCP/IP层复杂的操作抽象为几个简单的接口供应用层调用以实现进程在网络中通信。 ![在这里插入图片描述...
《神一样的产品经理》书中表格 产品sprint backlog.xlsx
支持linux百万级并发的参数, To support over 500k users, you *need* - A 64 bits hardware/kernel (AMD64, Opterons) - At least 8GB of ram - A recent linux kernel (2.6.x) About tuning, I prefer to not ...
敏捷测试工具开发backlog敏捷测试工具开发backlog敏捷测试工具开发backlog敏捷测试工具开发backlog
scrum product backlog
基于springboot+vue的在线考试系统的实现.zip基于springboot+vue的在线考试系统的实现.zip基于springboot+vue的在线考试系统的实现.zip ...http://localhost:8080/backLogin ``` 用户名 zhaosi 密码 123456 ```
Product backlog template 敏捷 scrum
1、什么是产品backlog; 2、sprint计划会议,会议产生的结果; 3、每日例会; 4、sprint界限。 5、确定sprint长度; 6、sprint会议产生的结果。
敏捷软件开发Sprint Backlog模板工作计划进度跟踪Excel版本。
hubot-backlog-assign 将积压问题分配给审阅者的 Hubot 脚本安装 $ npm install https://github.com/bouzuya/hubot-backlog-assign/archive/master.tar.gz或者 $ npm install .../archive/{VERSION}.tar.gz例子 bouzuya...
java项目-第64期基于ssm的在线考试系统 1、项目简述 该项目是一款在线考试系统,该系统包含两个角色:老师和学生。老师负责后台的学生维护、试卷维护、考试维护等。 学生在前台负责考试答题,并查看考试结果记录。...
#此参数确定了TCP连接中已完成队列(完成三次握手之后)的长度, 当然此值必须不大于Linux系统定义的/proc/sys/net/core/somaxconn值,默认是511,而Linux的默认参数值是128。当系统并发量大并且客户端速度缓慢的时候...
项目使积压易于使用 [第1号]快速打开任务 ▼描述 仅通过指定数字打开任务的扩展 ▼如何使用 按“#”并在显示的文本框中输入任务编号(* 1),然后按Enter键。 在新选项卡上打开时按Ctrl + Enter。 (* 1)任务编号...
soeket 文件传输 #define MAX_LENGTH 1024 /*包头的结构体定义*/ typedef struct tPachHead { char iFileSize; /*为0表示发送的是文件名,1表示发送的是数据,2表示发送完毕*/ ...#define BACKLOG 10
所以,用1.x版开发的服务端或客户端代码需要进行修改以适应2.x版中函数的变化:在2.x版中,所有的gSOAP函数都增加了一个参 数用来保存一个gSOAP运行环境实例。这个参数包括了文件描述,表,缓冲,标志位等,它在...