-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftpactivebinarydataout.h
92 lines (83 loc) · 2.29 KB
/
ftpactivebinarydataout.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef FTPACTIVEBINARYDATAOUT_H
#define FTPACTIVEBINARYDATAOUT_H
#include <QTcpSocket>
#include <QHostAddress>
#include <QFile>
#include <QDataStream>
/**
* @brief Класс обеспечивает приём данных в активном режиме от сервера клиенту
*
*/
class FTPActiveBinaryDataOut : public QTcpSocket
{
Q_OBJECT
static const qint64 blockSize = 8192; /**< TODO Размер передаваемого блока*/
public:
/**
* @brief Конструктор класса. Создаёт объект класса и создаёт TCP подключения к aHostAdress на aHostPor
*
* @param aHostAdress адрес клиента
* @param aHostPort порт клиента
* @param aLocalAdress локальный адрес сервера
* @param aLocalPort локальный порт сервера
* @param parent Родительский объект
*/
explicit FTPActiveBinaryDataOut(QHostAddress aHostAdress,int aHostPort, QHostAddress aLocalAdress, int aLocalPort, QObject *parent=0);
/**
* @brief Деструктор класса. Закрывает все соединения, если они открыты
*
*/
~FTPActiveBinaryDataOut();
/**
* @brief Поток для чтения передаваемого файла
*
* @param aStream поток
*/
void sendFile(QDataStream *aStream);
/**
* @brief Прерывание соединения
*
*/
void abortConnection();
signals:
/**
* @brief Сигнал высылается после того, как произошла ошибка во время передачи файла
*
*/
void errorSendBinaryDataSignal();
/**
* @brief Сигнал высылается после обрыва соединения
*
*/
void connectionCloseByClientSignal();
/**
* @brief Сигнал высылается после успешной передачи файла клиенту
*
*/
void sendBinaryDataSuccessfulSignal();
/**
* @brief Сигнал высылается после того, как соединение было успешно прервано
*
*/
void abortConnectionSignal();
public slots:
private slots:
/**
* @brief Слот для обработки прерывания клиентом соединения
*
*/
void connectionCloseByClientSlot();
/**
* @brief Слот для продолжения передачи файла после успешного отправления предыдущих данных
*
*/
void continueTransferBinaryDataSlot();
/**
* @brief Слот для обрыва соединения
*
*/
void abortConnectionSlot();
private:
QDataStream *outStream; /**< TODO Поток для чтения передаваемых данных */
};
#endif // FTPACTIVEBINARYDATAOUT_H