Qt编写TCP通讯程序 客户端与服务器端超级详细教程.dect(server, SIGNAL(newConnection()), this,SLOT(newLocalConnection()));
if(server->listen(serverName))
{
//防止程序崩溃时,残留进程服务,移除之
if(server->serverError()== QAbstractSocket::AddressInUseError &&QFile::exists(server->serverName()))
{
QFile::remove(server->serverName());
server->listen(serverName);
}
}
}
voidMainWidget::newLocalConnection()
{
QLocalSocket *socket =serve2674
2019-12-21 20:36:18
364KB
TCP通讯
1