QtNetwork documentation: Emphasize QTcpServer::addPendingConnection().

Add note mentioning it to QTcpSocket::incomingConnection() and
update SSL socket server code snippet accordingly.

Change-Id: I9d228dabde76f9e9cd5140edf08be09a588066c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Friedemann Kleint 2015-09-16 11:14:21 +02:00
parent 42c6ea4f6c
commit 72bd5d1db9
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -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