diff --git a/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp b/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp index a7ab8c09771..3bd57f1d446 100644 --- a/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp +++ b/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp @@ -51,7 +51,8 @@ void SslServer::incomingConnection(qintptr socketDescriptor) { QSslSocket *serverSocket = new QSslSocket; if (serverSocket->setSocketDescriptor(socketDescriptor)) { - connect(serverSocket, SIGNAL(encrypted()), this, SLOT(ready())); + addPendingConnection(serverSocket); + connect(serverSocket, &QSslSocket::encrypted, this, &SslServer::ready); serverSocket->startServerEncryption(); } else { delete serverSocket; diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 914c14877e0..bf75666548f 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -559,6 +559,10 @@ QTcpSocket *QTcpServer::nextPendingConnection() may not be usable with native socket functions, and should only be used with QTcpSocket::setSocketDescriptor(). + \note If another socket is created in the reimplementation + of this method, it needs to be added to the Pending Connections mechanism + by calling addPendingConnection(). + \note If you want to handle an incoming connection as a new QTcpSocket object in another thread you have to pass the socketDescriptor to the other thread and create the QTcpSocket object there and