#include "mytcpserver.h" MyTcpServer::MyTcpServer(QObject *parent) : QObject{parent} { Server=new QTcpServer(); connect(Server,&QTcpServer::newConnection,this,&MyTcpServer::OnConnected); Server->listen(QHostAddress(LocalIP),LocalPort); } void MyTcpServer::OnConnected() { qDebug()<<"Connected"; }