qrs吧 关注:33贴子:833
  • 1回复贴,共1

qt socket 服务端 获取客户端ip

收藏回复

void FortuneServer::incomingConnection(int socketDescriptor)
{
     TcpClientSocket *clientConnection=new TcpClientSocket(this);
     if (!clientConnection->setSocketDescriptor(socketDescriptor))
     {
         return;
     }
     QString Iip=clientConnection->peerAddress ().toString();获取客户端ip
     qDebug()<<Iip;
}


IP属地:北京1楼2011-01-20 09:44回复
    多谢了


    IP属地:湖南2楼2011-11-12 16:09
    回复