1.bool hasPendingDatagrams() const
Returns true if at least one datagram is waiting to be read; otherwise returns false.
2.bool joinMulticastGroup(const QHostAddress &groupAddress)
3.bool joinMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface)
4.bool leaveMulticastGroup(const QHostAddress &groupAddress)
5.bool leaveMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface)
6.QNetworkInterface multicastInterface() const
7.qint64 pendingDatagramSize() const
Returns the size of the first pending UDP datagram. If there is no datagram available, this function returns -1.
8.qint64 readDatagram(char *data, qint64 maxSize, QHostAddress *address = Q_NULLPTR, quint16 *port = Q_NULLPTR)
Receives a datagram no larger than maxSize bytes and stores it in data. The sender’s host address and port is stored in *address and *port (unless the pointers are 0);
Returns the size of the datagram on success; otherwise returns -1;
If maxSize is too small, the rest of the datagram will be lost. To avoid loss of data, call pendingDatagramSize() to determine the size of the pending datagram before attempting to read it. If maxSize is 0, the datagram will be discarded;
9.QNetworkDatagram receiveDatagram(qint64 maxSize = -1)
Receives a datagram no larger than maxSize bytes and returns it in the QNetworkDatagram object, along with the sender’s host address and port. If possible, this function will also try to determine the datagram’s destination address, port, and the number of hop counts at reception time;
On failure, returns a QNetworkDatagram that reports not valid;
If maxSize is too small, the rest of the datagram will be lost. If maxSize is 0, the datagram will be discarded. If maxSize is -1 (the default), this function will attempt to read the entire datagram.
10.void setMulticastInterface(const QNetworkInterface &iface)
11.qint64 writeDatagram(const char *data, qint64 size, const QHostAddress &address, quint16 port)
12.qint64 writeDatagram(const QNetworkDatagram &datagram)
13.qint64 writeDatagram(const QByteArray &datagram, const QHostAddress &host, quint16 port)