我正在开发一些服务器应用程序,该框架是子类化QTcpServer
的,命名为UeTcpServer
. ueSlotTcpServerNewConnection()
服务器应用程序正常启动,当我在连接到UeTcpServer
的断点时newConnectionSignal
通过
connect(this->ueTcpServer(),
SIGNAL(newConnection()),
this,
SLOT(ueSlotTcpServerNewConnection()));
然后使用连接到服务器应用程序Linux terminal
,断点在ueSlotTcpServerNewConnection()
插槽内激活:
void UeMainWindow::ueSlotTcpServerNewConnection()
{
if(this->ueTcpServer()->hasPendingConnections())
{
QTcpSocket* incomingSocket=this->ueTcpServer()->nextPendingConnection();
this->ueSlotAddEventInfoLog(0,
tr("New incoming connection from host")
.append(" ")
//.append(this->ueTcpServer()->nextPendingConnection()->peerAddress().toString())
.append(incomingSocket->peerName())
.append(" ")
.append(tr("with IP address"))
.append(" ")
.append(incomingSocket->peerAddress().toString())
.append(" ")
.append(tr("using port"))
.append(" ")
//.append(this->ueTcpServer()->nextPendingConnection()->peerPort()));
.append(QString::number(incomingSocket->peerPort())));
} // if
} // ueSlotTcpServerNewConnection
但是,this->ueTcpServer()->hasPendingConnection()
返回false
. 为什么?