TCP三次握手和四次挥手

TCP的连接建立是一个三次握手过程,目的是为了通信双方确认开始序号,以便后续

通信的有序进行。主要步骤如下:

1. 连接开始时,连接建立方(Client)发送SYN包,并包含了自己的初始序号a;

2. 连接接受方(Server)收到SYN包以后会回复一个SYN包,其中包含了对上一个a包

的回应信息ACK,回应的序号为下一个希望收到包的序号,即a+1,然后还包含

了自己的初始序号b;

3. 连接建立方(Client)收到回应的SYN包以后,回复一个ACK包做响应,其中包含了

下一个希望收到包的序号即b+1。

TCP终止连接的四次握手过程如下:

1. 首先进行关闭的一方(即发送第一个FIN)将执行主动关闭,而另一方(收到这

个FIN)执行被动关闭。

2. 当服务器收到这个FIN,它发回一个ACK,确认序号为收到的序号加1。和SYN一

样,一个FIN将占用一个序号。

3. 同时TCP服务器还向应用程序(即丢弃服务器)传送一个文件结束符。接着这个

服务器程序就关闭它的连接,导致它的TCP端发送一个FIN。

4. 客户必须发回一个确认,并将确认序号设置为收到序号加1。

posted @ 2019-03-20 10:10  strawqqhat  阅读(147)  评论(0编辑  收藏  举报
#home h1{ font-size:45px; } body{ background-image: url("放你的背景图链接"); background-position: initial; background-size: cover; background-repeat: no-repeat; background-attachment: fixed; background-origin: initial; background-clip: initial; height:100%; width:100%; } #home{ opacity:0.7; } .wall{ position: fixed; top: 0; left: 0; bottom: 0; right: 0; } div#midground{ background: url("https://i.postimg.cc/PP5GtGtM/midground.png"); z-index: -1; -webkit-animation: cc 200s linear infinite; -moz-animation: cc 200s linear infinite; -o-animation: cc 200s linear infinite; animation: cc 200s linear infinite; } div#foreground{ background: url("https://i.postimg.cc/z3jZZD1B/foreground.png"); z-index: -2; -webkit-animation: cc 253s linear infinite; -o-animation: cc 253s linear infinite; -moz-animation: cc 253s linear infinite; animation: cc 253s linear infinite; } div#top{ background: url("https://i.postimg.cc/PP5GtGtM/midground.png"); z-index: -4; -webkit-animation: da 200s linear infinite; -o-animation: da 200s linear infinite; animation: da 200s linear infinite; } @-webkit-keyframes cc { from{ background-position: 0 0; transform: translateY(10px); } to{ background-position: 600% 0; } } @-o-keyframes cc { from{ background-position: 0 0; transform: translateY(10px); } to{ background-position: 600% 0; } } @-moz-keyframes cc { from{ background-position: 0 0; transform: translateY(10px); } to{ background-position: 600% 0; } } @keyframes cc { 0%{ background-position: 0 0; } 100%{ background-position: 600% 0; } } @keyframes da { 0%{ background-position: 0 0; } 100%{ background-position: 0 600%; } } @-webkit-keyframes da { 0%{ background-position: 0 0; } 100%{ background-position: 0 600%; } } @-moz-keyframes da { 0%{ background-position: 0 0; } 100%{ background-position: 0 600%; } } @-ms-keyframes da { 0%{ background-position: 0 0; } 100%{ background-position: 0 600%; } }