45 #include <QtNetwork/qabstractsocket.h> 46 #include <QtNetwork/qhostaddress.h> 54 #ifndef QT_NO_UDPSOCKET 64 DefaultForPlatform = 0x0,
66 DontShareAddress = 0x2,
67 ReuseAddressHint = 0x4
77 bool bind(
quint16 port, BindMode mode);
80 #ifndef QT_NO_NETWORKINTERFACE 81 bool joinMulticastGroup(
const QHostAddress &groupAddress);
82 bool joinMulticastGroup(
const QHostAddress &groupAddress,
84 bool leaveMulticastGroup(
const QHostAddress &groupAddress);
85 bool leaveMulticastGroup(
const QHostAddress &groupAddress,
92 bool hasPendingDatagrams()
const;
93 qint64 pendingDatagramSize()
const;
97 {
return writeDatagram(datagram.
constData(), datagram.
size(), host, port); }
106 #endif // QT_NO_UDPSOCKET 112 #endif // QUDPSOCKET_H qint64 writeDatagram(const QByteArray &datagram, const QHostAddress &host, quint16 port)
Sends the datagram datagram to the host address host and at port port.
The QUdpSocket class provides a UDP socket.
#define QT_END_NAMESPACE
This macro expands to.
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
The QByteArray class provides an array of bytes.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
The QObject class is the base class of all Qt objects.
BindFlag
This enum describes the different flags you can pass to modify the behavior of QUdpSocket::bind().
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
static const char * data(const QByteArray &arr)
const char * constData() const
Returns a pointer to the data stored in the byte array.
int size() const
Returns the number of bytes in this byte array.
#define Q_DECLARE_PRIVATE(Class)
The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces...
The QHostAddress class provides an IP address.
The QAbstractSocket class provides the base functionality common to all socket types.