关于QT中的网络模块中QTcpServer类,C/S模式的并发连接访问----请教
看了看QT自带的那几个有关QTcpServer和QTcpSocket的例子。例子中服务器是一直等待新连接直到newConnection 信号触发。建立信号槽连接 connect(tcpServer, SIGNAL(newConnection()), this, SLOT(sendFortune()));QTcpServer::nextPendingConnection() 返回一个已连接的QTcpSocket指针。如clientConnection=tcpServer.nextPendingConnection()然后 connect(clientConnection, SIGNAL(disconnected()), clientConnection, SLOT(deleteLater()));connect(clientConnection, SIGNAL(readyRead()), clientConnection, SLOT(dealData()));如上所示:这种方案是不是就是迭代型服务器? QT中的网络模块有提供了并发服务的API麽 ?难道只有做成多线程的 来一个连接 启动一个线程处理?多线程中要涉及加锁和信号量 线程安全等 。另外 不知道QT中有没有IO复用的概念?