culturered_client/PhotoDisplay/NetClient.h

29 lines
532 B
C
Raw Normal View History

2024-09-07 03:34:44 +00:00
#pragma once
#include <QUdpSocket>
#include <QNetworkAccessManager>
class NetClient : public QObject {
Q_OBJECT
public:
explicit NetClient(QObject* param = nullptr);
~NetClient() override = default;
bool Start(quint16 port);
void Stop();
Q_SIGNALS:
void FileReady(const QString& filePath);
protected:
void OnReadyRead();
void ParseMessage(const QByteArray& message);
void DownlaodFile(const QString& fileName);
void DownloadFinish();
private:
QUdpSocket* m_udpSocket{nullptr};
QNetworkAccessManager m_manager;
};