C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 2915|回复: 0

TCP握手协议 [复制链接]

军衔等级:

亚星游戏官网-yaxin222  下士

注册:2007-2-21
发表于 2009-3-27 21:04:24 |显示全部楼层
TCP握手协议

在TCP/IP协议中,TCP协议提供可靠的连接服务,采用三次握手建立一个连接。

第一次握手:建立连接时,客户端发送syn包(syn=j)到服务器,并进入SYN_SEND状态,等待服务器确认;

第二次握手:服务器收到syn包,必须确认客户的SYN(ack=j+1),同时自己也发送一个SYN包(syn=k),即SYN+ACK包,此时服务器进入SYN_RECV状态;

第三次握手:客户端收到服务器的SYN+ACK包,向服务器发送确认包ACK(ack=k+1),此包发送完毕,客户端和服务器进入ESTABLISHED状态,完成三次握手。

完成三次握手,客户端与服务器开始传送数据,在上述过程中,还有一些重要的概念:

未连接队列:在三次握手协议中,服务器维护一个未连接队列,该队列为每个客户端的SYN包(syn=j)开设一个条目,该条目表明服务器已收到SYN包,并向客户发出确认,正在等待客户的确认包。这些条目所标识的连接在服务器处于Syn_RECV状态,当服务器收到客户的确认包时,删除该条目,服务器进入ESTABLISHED状态。
Backlog参数:表示未连接队列的最大容纳数目。

SYN-ACK 重传次数服务器发送完SYN-ACK包,如果未收到客户确认包,服务器进行首次重传,等待一段时间仍未收到客户确认包,进行第二次重传,如果重传次数超过系统规定的最大重传次数,系统将该连接信息从半连接队列中删除。注意,每次重传等待的时间不一定相同。

半连接存活时间:是指半连接队列的条目存活的最长时间,也即服务从收到SYN包到确认这个报文无效的最长时间,该时间值是所有重传请求包的最长等待时间总和。有时大家也称半连接存活时间为Timeout时间、SYN_RECV存活时间。

TCP handshakeagreement

In TCP / IP protocol in, TCP protocol to provide reliableconnectivity, using three shook hands with the establishment of aconnection.

The first handshake: establish a connection, the client sent synpackets (syn = j) to the server and access SYN_SEND state, waitingfor the server to confirm;

Second handshake: Server received syn package, customers mustconfirm the SYN (ack = j +1), while himself a SYN packet sent (syn= k), that is, SYN + ACK packet, then enter the server SYN_RECVstate;

Third handshake: client server received the SYN + ACK packet, sendconfirmation to the server package ACK (ack = k +1), this packagesent completed, the client and server into the ESTABLISHED state,complete the three shook hands.

Complete the three shook hands with the client and server startsending data, in the process, there are some importantconcepts:

Not connected cohort: the three shook hands with the agreement,maintaining a server is not connected queue, as the team eachclient SYN packet (syn = j) creation of an entry, the entry serverthat has received SYN packet, and customers identified , Isawaiting confirmation, the package. These entries by the logo ofSyn_RECV connected to the server in the state, when the clientserver received the confirmation package, delete the entry into theserver ESTABLISHED state.
Backlog parameters: that is not connected to accommodate thelargest number of the queue.

SYN-ACK re-sent the number of servers End SYN-ACK packets, ifcustomers have not received confirmation package, the firstre-server, waiting for customers for a period of time has not yetreceived confirmation package, the second-Chuan, if re - More thanthe number of requirements for re-largest number of systems toconnect information from the semi-connected in the queue to delete.Note that each re-waiting time does not necessarily the same.

Semi-connected survival time: connect queue is half the entry ofthe most prolonged survival, or services received from the SYNpacket to confirm that the text was invalid, the longest period,the time value of all repeat request of the longest wait for thepackage The total time. Sometimes we also said that the survivaltime for the semi-connected Timeout time, SYN_RECV survivaltime.

举报本楼

您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系大家 |网站地图  

GMT+8, 2024-11-28 01:56 , Processed in 0.129557 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图