使用netcat(nc命令)发送udp包

  • 向192.168.31.65的2055端口发送udp测试数据
echo "Hello World\!" | nc -4u  192.168.31.65 2055

可以在192.168.31.65上用tcpdump观察:
可以看到右侧有我们发送的数据(“Hello World!”).

$ tcpdump -i ens160 -nn -vv -X udp port 2055
tcpdump: listening on ens160, link-type EN10MB (Ethernet), capture size 262144 bytes

14:36:43.812741 IP (tos 0x0, ttl 58, id 4753, offset 0, flags [none], proto UDP (17), length 42)
    192.168.31.64.50909 > 192.168.31.65.2055: [udp sum ok] UDP, length 14
        0x0000:  4500 002a 1291 0000 3a11 3d49 0a01 192f  E..*....:.=I.../
        0x0010:  0a19 03a1 c6dd 0807 0016 8cbf 4865 6c6c  ............Hell
        0x0020:  6f20 576f 726c 645c 210a 0000 0000       o.World\!.....
14:37:52.925069 IP (tos 0x0, ttl 58, id 4757, offset 0, flags [none], proto UDP (17), length 42)

欢迎补充指正!

发布了231 篇原创文章 · 获赞 77 · 访问量 52万+

猜你喜欢

转载自blog.csdn.net/butterfly5211314/article/details/89674577