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:
parent
42c6ea4f6c
commit
72bd5d1db9
@ -51,7 +51,8 @@ void SslServer::incomingConnection(qintptr socketDescriptor)
|
|||||||
{
|
{
|
||||||
QSslSocket *serverSocket = new QSslSocket;
|
QSslSocket *serverSocket = new QSslSocket;
|
||||||
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
|
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
|
||||||
connect(serverSocket, SIGNAL(encrypted()), this, SLOT(ready()));
|
addPendingConnection(serverSocket);
|
||||||
|
connect(serverSocket, &QSslSocket::encrypted, this, &SslServer::ready);
|
||||||
serverSocket->startServerEncryption();
|
serverSocket->startServerEncryption();
|
||||||
} else {
|
} else {
|
||||||
delete serverSocket;
|
delete serverSocket;
|
||||||
|
@ -559,6 +559,10 @@ QTcpSocket *QTcpServer::nextPendingConnection()
|
|||||||
may not be usable with native socket functions, and should only be
|
may not be usable with native socket functions, and should only be
|
||||||
used with QTcpSocket::setSocketDescriptor().
|
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
|
\note If you want to handle an incoming connection as a new QTcpSocket
|
||||||
object in another thread you have to pass the socketDescriptor
|
object in another thread you have to pass the socketDescriptor
|
||||||
to the other thread and create the QTcpSocket object there and
|
to the other thread and create the QTcpSocket object there and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user