QtCraft API C++ classes QML types Handbook

QcNetworkServer Class

Accepts TCP connections for a QcServer in the server's thread (decision E-251): every accepted socket becomes a QcTcpTransport and a remote client of the server, which logs it in; no data is shared with another thread, so the game state needs no locks. More...

Header: #include <server/network/QcNetworkServer.h>
Inherits: QObject

Public Functions

QcNetworkServer(const QcNetworkServer &)
QcNetworkServer(QcNetworkServer &&)
QcResult<quint16> listen()
int openConnections() const
quint16 port() const
quint64 refusedConnections() const
QcNetworkServer &operator=(QcNetworkServer &&)
QcNetworkServer &operator=(const QcNetworkServer &)

Detailed Description

New connections pass the QcConnectionLimiter first, then the TLS handshake begins (decision E-872).

Member Function Documentation

[delete] QcNetworkServer::QcNetworkServer(const QcNetworkServer &)

Copy-constructs an instance of QcNetworkServer. This function is deleted.

[delete] QcNetworkServer::QcNetworkServer(QcNetworkServer &&)

Move-constructs an instance of QcNetworkServer. This function is deleted.

QcResult<quint16> QcNetworkServer::listen()

Starts listening. Returns the port in use (the configured one, or a free one for port 0) or why listening failed.

int QcNetworkServer::openConnections() const

Returns the number of open connections.

quint16 QcNetworkServer::port() const

Returns the port the listener listens on.

quint64 QcNetworkServer::refusedConnections() const

Returns the connections refused by the limits since the start.

[delete] QcNetworkServer &QcNetworkServer::operator=(QcNetworkServer &&)

Move-assigns other to this QcNetworkServer instance. This function is deleted.

[delete] QcNetworkServer &QcNetworkServer::operator=(const QcNetworkServer &)

Copy-assigns other to this QcNetworkServer instance. This function is deleted.