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