📄 server.cpp
字号:
#include "server.h"
#include "serverthread.h"
Server::Server(MainWindow *m,int p,QHostAddress a)
{
this->hostAddress=a;
this->port=p;
this->mainWindow=m;
this->clientNum=0;
this->QTcpServer::listen(hostAddress,quint16(port));
connect(this,SIGNAL(printText(const char*)),this->mainWindow,SLOT(showText(const char*)));
}
void Server::incomingConnection(int handle)
{
char ch[]="new connection !";
emit printText(ch);
ServerThread *thread=new ServerThread(handle,this,mainWindow,this->clientNum);
this->clientNum++;
thread->start();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -