The QSctpServer class provides an SCTP-based server. More...
|qmake:||QT += network|
This class was introduced in Qt 5.8.
|QSctpServer(QObject *parent = nullptr)|
Reimplemented Protected Functions
|virtual void||incomingConnection(qintptr socketDescriptor) override|
SCTP (Stream Control Transmission Protocol) is a transport layer protocol serving in a similar role as the popular protocols TCP and UDP. Like UDP, SCTP is message-oriented, but it ensures reliable, in-sequence transport of messages with congestion control like TCP. See the QSctpSocket documentation for more protocol details.
QSctpServer is a convenience subclass of QTcpServer that allows you to accept incoming SCTP socket connections either in TCP emulation or in datagram mode.
The most common way to use QSctpServer is to construct an object and set the maximum number of channels that the server is prepared to support, by calling setMaximumChannelCount(). You can set the TCP emulation mode by passing a negative argument in this call. Also, a special value of 0 (the default) indicates to use the peer's value as the actual number of channels. The new incoming connection inherits this number from the server socket descriptor and adjusts it according to the remote endpoint settings.
In TCP emulation mode, accepted clients use a single continuous byte stream for data transmission, and QSctpServer acts like a plain QTcpServer. Call nextPendingConnection() to accept the pending connection as a connected QTcpSocket. The function returns a pointer to a QTcpSocket in QAbstractSocket::ConnectedState that you can use for communicating with the client. This mode gives access only to basic SCTP protocol features. The socket transmits SCTP packets over IP at system level and interacts through the QTcpSocket interface with the application.
In contrast, datagram mode is message-oriented and provides a complete simultaneous transmission of multiple data streams between endpoints. Call nextPendingDatagramConnection() to accept the pending datagram-mode connection as a connected QSctpSocket.
Note: This feature is not supported on the Windows platform.
See also QTcpServer, QSctpSocket, and QAbstractSocket.
Member Function Documentation
QSctpServer::QSctpServer(QObject *parent = nullptr)
Constructs a QSctpServer object.
Sets the datagram operation mode. The parent argument is passed to QObject's constructor.
See also setMaximumChannelCount(), listen(), and setSocketDescriptor().
Destroys the QSctpServer object. If the server is listening for connections, the socket is automatically closed.
See also close().
[override virtual protected] void QSctpServer::incomingConnection(qintptr socketDescriptor)
Reimplements: QTcpServer::incomingConnection(qintptr socketDescriptor).
int QSctpServer::maximumChannelCount() const
Returns the maximum number of channels that the accepted sockets are able to support.
A value of 0 (the default) means that the number of connection channels would be set by the remote endpoint.
Returns -1, if QSctpServer running in TCP emulation mode.
See also setMaximumChannelCount().
Returns the next pending datagram-mode connection as a connected QSctpSocket object.
Datagram-mode connection provides a message-oriented, multi-stream communication.
The socket is created as a child of the server, which means that it is automatically deleted when the QSctpServer object is destroyed. It is still a good idea to delete the object explicitly when you are done with it, to avoid wasting memory.
This function returns null if there are no pending datagram-mode connections.
Note: The returned QSctpSocket object cannot be used from another thread. If you want to use an incoming connection from another thread, you need to override incomingConnection().
See also hasPendingConnections(), nextPendingConnection(), and QSctpSocket.
void QSctpServer::setMaximumChannelCount(int count)
Sets the maximum number of channels that the server is prepared to support in datagram mode, to count. If count is 0, endpoint maximum number of channels value would be used. Negative count sets a TCP emulation mode.
Call this method only when QSctpServer is in UnconnectedState.
See also maximumChannelCount() and QSctpSocket.
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.