4#include <private/qqmldebugserverconnection_p.h>
5#include <private/qqmldebugserver_p.h>
7#include <QtCore/qplugin.h>
8#include <QtNetwork/qtcpserver.h>
9#include <QtNetwork/qtcpsocket.h>
23 bool setPortRange(
int portFrom,
int portTo,
bool block,
const QString &hostaddress)
override;
30 void flush()
override;
67 qWarning(
"QML Debugger: Failed to send remaining %lld bytes on disconnect.",
80 m_portFrom = portFrom;
83 m_hostaddress = hostaddress;
106bool QTcpServerConnection::listen()
110 this, &QTcpServerConnection::newConnection);
112 if (!m_hostaddress.
isEmpty()) {
115 qDebug(
"QML Debugger: Incorrect host address provided. So accepting connections "
121 int port = m_portFrom;
124 qDebug(
"QML Debugger: Waiting for connection on port %d...",
port);
128 }
while (
port <= m_portTo);
129 if (
port > m_portTo) {
130 if (m_portFrom == m_portTo)
131 qWarning(
"QML Debugger: Unable to listen to port %d.", m_portFrom);
133 qWarning(
"QML Debugger: Unable to listen to ports %d - %d.", m_portFrom, m_portTo);
140void QTcpServerConnection::newConnection()
142 if (m_socket && m_socket->
peerPort()) {
143 qWarning(
"QML Debugger: Another client is already connected.");
145 delete faultyConnection;
172#include "qtcpserverconnection.moc"
bool flush()
This function writes as much as possible from the internal write buffer to the underlying network soc...
quint16 peerPort() const
Returns the port of the connected peer if the socket is in ConnectedState; otherwise returns 0.
qint64 bytesToWrite() const override
Returns the number of bytes that are waiting to be written.
bool waitForBytesWritten(int msecs=30000) override
\reimp
SocketState state() const
Returns the state of the socket.
The QHostAddress class provides an IP address.
void setAddress(quint32 ip4Addr)
Set the IPv4 address specified by ip4Addr.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void setParent(QObject *parent)
Makes the object a child of parent.
void deleteLater()
\threadsafe
virtual void setDevice(QIODevice *socket)=0
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QQmlDebugServerConnection * create(const QString &key) override
void setServer(QQmlDebugServer *server) override
void disconnect() override
~QTcpServerConnection() override
bool isConnected() const override
bool setFileName(const QString &fileName, bool block) override
bool setPortRange(int portFrom, int portTo, bool block, const QString &hostaddress) override
void waitForConnection() override
The QTcpServer class provides a TCP-based server.
void newConnection()
This signal is emitted every time a new connection is available, regardless of whether it has been ad...
virtual QTcpSocket * nextPendingConnection()
Returns the next pending connection as a connected QTcpSocket object.
bool listen(const QHostAddress &address=QHostAddress::Any, quint16 port=0)
Tells the server to listen for incoming connections on address address and port port.
bool waitForNewConnection(int msec=0, bool *timedOut=nullptr)
Waits for at most msec milliseconds or until an incoming connection is available.
The QTcpSocket class provides a TCP socket.
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage return DBusPendingCall DBusPendingCall return DBusPendingCall return dbus_int32_t return DBusServer * server
#define QQmlDebugServerConnectionFactory_iid
QLatin1StringView QLatin1String