Value | Flag Type | Description |
---|---|---|
S | SYN | Connection Start |
F | FIN | Connection Finish |
P | PUSH | Data push |
R | RST | Connection reset |
. | ACK | Acknowledgment |
tcp是传输层的协议
tcp的三次握手是指client与server端通过发送http请求,建立tcp连接, 分为三个步骤
第一步, client向server端发送建立连接的请求, 用SYN来标志, SYN用[S]来表示
第二步, server端收到clent端发来的SYN请求, 然后发送确认ACK并建立连接SYN, 用SYN+ACK标志, 用[S.]
第三步, client端发送给客户端确认的相应ACK, 用[.]来表示
下面是从浏览器(客户端) 发送HTTP GET 请求给server端, 利用tcpdump抓包工具打印出详细过程
[root@mybuildvm bandao]# tcpdump -i any -c5 -nn port 8080
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
(第一步) 01:20:59.617829 IP6 ::1.52734 > ::1.8080: Flags [S], seq 2772511575, win 43690, options [mss 65476,sackOK,TS val 51495764 ecr 0,nop,wscale 7], length 0
(第二步)15:50:22.569058 IP6 ::1.8080 > ::1.52734: Flags [S.], seq 3471702762, ack 2772511576, win 43690, options [mss 65476,sackOK,TS val 51495764 ecr 51495764,nop,wscale 7], length 0
(第三步)01:20:59.617871 IP6 ::1.52734 > ::1.8080: Flags [.], ack 1, win 342, options [nop,nop,TS val 51495764 ecr 51495764], length 0
(传输数据)01:20:59.618000 IP6 ::1.52734 > ::1.8080: Flags [P.], seq 1:405, ack 1, win 342, options [nop,nop,TS val 51495764 ecr 51495764], length 404
(响应完毕)01:20:59.618013 IP6 ::1.8080 > ::1.52734: Flags [.], ack 405, win 350, options [nop,nop,TS val 51495764 ecr 51495764], length 0
5 packets captured
10 packets received by filter
0 packets dropped by kernel
https://opensource.com/article/18/10/introduction-tcpdump
http://www.tcpipguide.com/free/t_TCPConnectionEstablishmentProcessTheThreeWayHandsh-3.htm
<未完待续~~~~~~~~~~~~~>
请点赞支持, 谢谢:)
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。