-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtcpserver.h
59 lines (44 loc) · 1008 Bytes
/
tcpserver.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
#ifndef TCPSERVER_H
#define TCPSERVER_H
#include <QDialog>
#include <QTcpServer>
#include <QFile>
#include <QTime>
namespace Ui {
class TcpServer;
}
class TcpServer : public QDialog
{
Q_OBJECT
public:
explicit TcpServer(QWidget *parent = 0);
~TcpServer();
void refused();
void initServer();
protected:
void changeEvent(QEvent *);
void closeEvent(QCloseEvent *);
private:
Ui::TcpServer *ui;
qint16 tcpPort;
QTcpServer *tcpServer;
QString fileName;
QString theFileName;
QFile *localFile;
qint64 TotalBytes;
qint64 bytesWritten;
qint64 bytesToWrite;
qint64 playloadSize;
QByteArray outBlock;
QTcpSocket *clientConnection;
QTime time;
private slots:
void on_serverOpenBtn_clicked();
void on_serverSendBtn_clicked();
void on_serverCloseBtn_clicked();
void sendMessage();
void updateClientProgress(qint64 numBytes);
signals:
void sendFileName(QString fileName);
};
#endif // TCPSERVER_H