wireshark 下载地址
https://www.wireshark.org/download.html
启动软件,监听本地网络
设置过滤器
启动服务端
服务端的ip:192.168.1.91,起动一个简单tcp服务器reactor
启动客户端
点击连接,这里就完成了三次握手
wireshark抓取三次握手的数据
详细如下:
1 5.215683 192.168.1.22 192.168.1.91 TCP 66 59982 → 8080 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 WS=256 SACK_PERM
0000 60 a4 4c 5f 4a 1d 08 60 6e c8 08 cc 08 00 45 00 .L_J..
n.....E.
0010 00 34 bc 17 40 00 40 06 00 00 c0 a8 01 16 c0 a8 .4..@.@.........
0020 01 5b ea 4e 1f 90 2d 9a 23 a0 00 00 00 00 80 02 .[.N..-.#.......
0030 fa f0 83 e8 00 00 02 04 05 b4 01 03 03 08 01 01 ................
0040 04 02 ..
2 5.215940 192.168.1.91 192.168.1.22 TCP 66 8080 → 59982 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 SACK_PERM WS=128
0000 08 60 6e c8 08 cc 60 a4 4c 5f 4a 1d 08 00 45 00 .n...
.L_J...E.
0010 00 34 00 00 40 00 40 06 b7 02 c0 a8 01 5b c0 a8 .4..@.@......[..
0020 01 16 1f 90 ea 4e 21 34 34 da 2d 9a 23 a1 80 12 .....N!44.-.#...
0030 72 10 c8 06 00 00 02 04 05 b4 01 01 04 02 01 03 r...............
0040 03 07 ..
3 5.216018 192.168.1.22 192.168.1.91 TCP 54 59982 → 8080 [ACK] Seq=1 Ack=1 Win=2102272 Len=0
0000 60 a4 4c 5f 4a 1d 08 60 6e c8 08 cc 08 00 45 00 .L_J..
n.....E.
0010 00 28 bc 18 40 00 40 06 00 00 c0 a8 01 16 c0 a8 .(..@.@.........
0020 01 5b ea 4e 1f 90 2d 9a 23 a1 21 34 34 db 50 10 .[.N..-.#.!44.P.
0030 20 14 83 dc 00 00 .....
文章参考与<零声教育>的C/C++linux服务期高级架构系统教程学习:链接