This must be the part that you want void MyServer::StartServer() { thisIp = 2346; if(!this->listen(QHostAddress::Any, thisIp)) { qDebug() << "Could not start server."; qDebug() << errorString(); } else { qDebug() << "Listening at" << thisIp; } } and here is the original. tutorial.