53 lines
954 B
C++
53 lines
954 B
C++
#ifndef FILETRANSECEIVER_H
|
|
#define FILETRANSECEIVER_H
|
|
|
|
#include <QObject>
|
|
#include <QThread>
|
|
#include<stdio.h>
|
|
#include<sys/types.h>
|
|
#include<sys/socket.h>
|
|
#include<netinet/in.h>
|
|
#include<arpa/inet.h>
|
|
#include<string.h>
|
|
#include<stdlib.h>
|
|
#include<unistd.h>
|
|
#include <fcntl.h>
|
|
#include <errno.h>
|
|
|
|
#define DOC_DIR "/home/plg/doc"
|
|
#define SEARCH 100
|
|
#define DOWN 200
|
|
#define END 500
|
|
#define FAIL 300
|
|
#define SUCCESS 400
|
|
#define UP 600
|
|
|
|
struct msg
|
|
{
|
|
int type;
|
|
int flag;
|
|
char buf[64];
|
|
char fname[100];
|
|
};
|
|
class FileTranseceiver : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit FileTranseceiver();
|
|
~FileTranseceiver(void);
|
|
|
|
int ftp_download(int connfd,struct msg info);
|
|
int upload_ftp(int connfd,struct msg info);
|
|
void start();
|
|
protected slots:
|
|
void connectListen();
|
|
private:
|
|
int sockfd;
|
|
int connfd;;
|
|
QThread *serverThead;
|
|
signals:
|
|
void fileRecieved(QString fileName);
|
|
};
|
|
|
|
#endif // FILETRANSECEIVER_H
|