-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtcpclient.h
54 lines (43 loc) · 1.02 KB
/
tcpclient.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
#ifndef TCPCLIENT_H
#define TCPCLIENT_H
#include <QDialog>
#include <QTcpSocket>
#include <QHostAddress>
#include <QFile>
#include <QTime>
namespace Ui {
class TcpClient;
}
class TcpClient : public QDialog
{
Q_OBJECT
public:
explicit TcpClient(QWidget *parent = 0);
~TcpClient();
void setHostAddress(QHostAddress address);
void setFileName(QString fileName){localFile = new QFile(fileName);}
protected:
void changeEvent(QEvent *);
void closeEvent(QCloseEvent *);
private:
Ui::TcpClient *ui;
QTcpSocket *tcpClient;
quint16 blockSize;
QHostAddress hostAddress;
qint16 tcpPort;
qint64 TotalBytes;
qint64 bytesReceived;
qint64 bytesToReceive;
qint64 fileNameSize;
QString fileName;
QFile *localFile;
QByteArray inBlock;
QTime time;
private slots:
void on_tcpClientCloseBtn_clicked();
void newConnect();
void readMessage();
void displayError(QAbstractSocket::SocketError);
void on_tcpClientCancelBtn_clicked();
};
#endif // TCPCLIENT_H