Wireshark文档阅读笔记-User Datagram Protocol(UDP)
生活随笔
收集整理的这篇文章主要介绍了
Wireshark文档阅读笔记-User Datagram Protocol(UDP)
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
UDP(User Datagram Protocol):用户数据协议,UDP是无状态的传输。
UDP没有提供任何检测机制,检测丢包,重复包,的功能。
基于UDP的协议有BOOTP,DNS,NTP,SNMP,...
UDP使用IP协议作文底层协议。
下面来用Wireshark抓下包。
如下C++代码:
#include <QCoreApplication> #include <QUdpSocket> #include <QNetworkDatagram> #include <QDebug>int main(int argc, char *argv[]) {QCoreApplication a(argc, argv);QUdpSocket server;server.bind(QHostAddress::LocalHost, 8888);QObject::connect(&server, &QUdpSocket::readyRead, [&](){while(server.hasPendingDatagrams()){QNetworkDatagram datagram = server.receiveDatagram();qDebug() << "server:" << datagram.data();}});QUdpSocket send;send.writeDatagram("Hello World", QHostAddress("127.0.0.1"), 8888);return a.exec(); }程序运行截图如下:
抓包如下:
如果数据大!!!
使用本地回环口测试还是一个包
总结
以上是生活随笔为你收集整理的Wireshark文档阅读笔记-User Datagram Protocol(UDP)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Ngnix笔记proxy_set_hea
- 下一篇: Qt笔记-QCryptographicH