一、QUdpSocket类用法介绍
(以下内容为QT帮助文档中的原文)
The QUdpSocket class provides a UDP socket.
QUdpSocket类提供了一个UDP socket套接字
UDP (User Datagram Protocol) is a lightweight, unreliable, datagram-oriented, connectionless protocol. It can be used when reliability isn't important. QUdpSocket is a subclass of QAbstractSocket that allows you to send and receive UDP datagrams.
UDP(用户数据报协议),是一个轻量的,不可靠的,面向数据报的,非连接的协议。当通讯要求的可靠性不重要时(可能数据会丢失),可以用UDP通信。QUdpSocket是QAbstractSocket的一个子类,它允许你发送和接收UDP数据报。
The most common way to use this class is to bind to an address and port using bind(), then call writeDatagram() and readDatagram() / receiveDatagram() to transfer data. If you want to use the standard QIODevice functions read(), readLine(), write(), etc., you must first connect the socket directly to a peer by calling connectToHost().
最常见的使用方式是用这个类中的函数 bind(),去绑定一个地址和端口