Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_network_socket_qudpsocket.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
5void Server::initSocket()
6{
7 udpSocket = new QUdpSocket(this);
8 udpSocket->bind(QHostAddress::LocalHost, 7755);
9
11 this, &Server::readPendingDatagrams);
12}
13
14void Server::readPendingDatagrams()
15{
16 while (udpSocket->hasPendingDatagrams()) {
17 QNetworkDatagram datagram = udpSocket->receiveDatagram();
18 processTheDatagram(datagram);
19 }
20}
void readyRead()
This signal is emitted once every time new data is available for reading from the device's current re...
The QNetworkDatagram class provides the data and metadata of a UDP datagram.
\reentrant
Definition qudpsocket.h:21
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)