#include #include "servermanager.h" ServerManager::ServerManager(QObject *parent) : QObject(parent) , m_server(new PTServer(this)) { } bool ServerManager::init(const QHostAddress &addr, const int &port) { return m_server->listen(addr, port); } void ServerManager::sendData(const QList &values, const qint64 ×tamp) { auto clients = m_server->getClients(); if (!clients.count()) return; QByteArray data; QDataStream stream(&data, QIODevice::WriteOnly); stream << timestamp << values.count(); foreach (auto value, values) stream << value; foreach (auto client, clients) client->send(1, data); }