DaemonService/DaemonService/daemonservice.cpp
2019-01-06 15:18:22 +08:00

26 lines
760 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "daemonservice.h"
#include <QTcpServer>
#include <QTcpSocket>
#include <QDebug>
#include <QThread>
#include "worker.h"
//DaemonService::DaemonService()
//{
// if (this->listen(QHostAddress::AnyIPv4, 9876))
// qDebug("The server started successfully!");
// else
// qCritical("Server failed to startError message%s", this->errorString().toStdString().data()); //错误信息
//}
/**
* @brief 当有新连接进入时
*/
void DaemonService::incomingConnection(qintptr socketDescriptor)
{
qDebug("new connect is connect %d有新的连接进入", socketDescriptor);
Worker *worker = new Worker(socketDescriptor, this->m_portList);
QThreadPool::globalInstance()->start(worker);
}