108 #ifndef QT_NO_UDPSOCKET
110 #define QT_CHECK_BOUND(function, a) do { \
112 qWarning(function" called on a QUdpSocket when not in QUdpSocket::BoundState"); \
124 {
return doEnsureInitialized(bindAddress, bindPort,
QHostAddress()); }
127 {
return doEnsureInitialized(
QHostAddress(), 0, remoteAddress); }
130 bool QUdpSocketPrivate::doEnsureInitialized(
const QHostAddress &bindAddress,
quint16 bindPort,
160 d_func()->isBuffered =
false;
172 #ifndef QT_NO_NETWORKINTERFACE
213 return d->socketEngine->joinMulticastGroup(groupAddress, iface);
252 return d_func()->socketEngine->leaveMulticastGroup(groupAddress, iface);
271 return d->socketEngine->multicastInterface();
288 qWarning(
"QUdpSocket::setMulticastInterface() called on a QUdpSocket when not in QUdpSocket::BoundState");
291 d->socketEngine->setMulticastInterface(iface);
305 return d_func()->socketEngine->hasPendingDatagrams();
317 return d_func()->socketEngine->pendingDatagramSize();
345 #if defined QUDPSOCKET_DEBUG
346 qDebug(
"QUdpSocket::writeDatagram(%p, %llu, \"%s\", %i)",
data,
size,
355 d->cachedSocketDescriptor =
d->socketEngine->socketDescriptor();
363 tr(
"Unable to send a datagram"));
366 d->setErrorAndEmit(
d->socketEngine->error(),
d->socketEngine->errorString());
409 #if defined QUDPSOCKET_DEBUG
410 qDebug(
"QUdpSocket::writeDatagram(%p, %i, \"%s\", %i)",
421 qint64 sent =
d->socketEngine->writeDatagram(datagram.d->
data,
424 d->cachedSocketDescriptor =
d->socketEngine->socketDescriptor();
429 d->setErrorAndEmit(
d->socketEngine->error(),
d->socketEngine->errorString());
455 #if defined QUDPSOCKET_DEBUG
456 qDebug(
"QUdpSocket::receiveDatagram(%lld)", maxSize);
461 maxSize =
d->socketEngine->pendingDatagramSize();
466 qint64 readBytes =
d->socketEngine->readDatagram(
result.d->data.data(), maxSize, &
result.d->header,
468 d->hasPendingData =
false;
469 d->socketEngine->setReadNotificationEnabled(
true);
471 d->setErrorAndEmit(
d->socketEngine->error(),
d->socketEngine->errorString());
475 result.d->data.truncate(readBytes);
499 #if defined QUDPSOCKET_DEBUG
507 readBytes =
d->socketEngine->readDatagram(
data, maxSize, &
header,
514 readBytes =
d->socketEngine->readDatagram(
data, maxSize);
517 d->hasPendingData =
false;
518 d->socketEngine->setReadNotificationEnabled(
true);
520 if (readBytes == -2) {
523 tr(
"No datagram available for reading"));
526 d->setErrorAndEmit(
d->socketEngine->error(),
d->socketEngine->errorString());
virtual bool isValid() const =0
The QAbstractSocket class provides the base functionality common to all socket types.
virtual bool bind(const QHostAddress &address, quint16 port=0, BindMode mode=DefaultForPlatform)
static constexpr auto UnknownNetworkLayerProtocol
SocketState state() const
QAbstractSocketEngine * socketEngine
void resolveProxy(const QString &hostName, quint16 port)
bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol)
qsizetype size() const noexcept
const char * constData() const noexcept
The QHostAddress class provides an IP address.\inmodule QtNetwork.
NetworkLayerProtocol protocol() const
void bytesWritten(qint64 bytes)
The QNetworkDatagram class provides the data and metadata of a UDP datagram.
QHostAddress destinationAddress() const
int destinationPort() const
The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces.
The QObject class is the base class of all Qt objects.
QByteArray toLatin1() const &
The QUdpSocket class provides a UDP socket.
bool leaveMulticastGroup(const QHostAddress &groupAddress)
bool joinMulticastGroup(const QHostAddress &groupAddress)
QNetworkDatagram receiveDatagram(qint64 maxSize=-1)
QNetworkInterface multicastInterface() const
bool hasPendingDatagrams() const
qint64 writeDatagram(const QNetworkDatagram &datagram)
void setMulticastInterface(const QNetworkInterface &iface)
qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *host=nullptr, quint16 *port=nullptr)
qint64 pendingDatagramSize() const
QUdpSocket(QObject *parent=nullptr)
bool ensureInitialized(const QHostAddress &bindAddress, quint16 bindPort)
bool ensureInitialized(const QHostAddress &remoteAddress)
constexpr Initialization Uninitialized
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLuint64EXT address
#define QT_CHECK_BOUND(function, a)
QHttpRequestHeader header("GET", QUrl::toPercentEncoding("/index.html"))
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent