51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#pragma once
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string>
|
|
#include <vector>
|
|
#ifdef _WIN32
|
|
#include <io.h>
|
|
#include <WinSock2.h>
|
|
#include <wininet.h>
|
|
//链接wininet.lib库
|
|
#pragma comment(lib,"wininet.lib")
|
|
#else
|
|
#include <fcntl.h>
|
|
#include <netdb.h>
|
|
#include <unistd.h>
|
|
#include <dirent.h>
|
|
#include <arpa/inet.h>
|
|
#endif // _WIN32
|
|
|
|
class FtpServer
|
|
{
|
|
public:
|
|
FtpServer();
|
|
~FtpServer();
|
|
// ftp 文件上传
|
|
int FtpUpload(const char* ip, const char* localPathName, const char* uploadPath);
|
|
int FtpDownload(const char* ip, const char* LocalPath, const char* LocalName, const char* downPath);
|
|
int FtpGetFileList(const char* ip, const char* filePath, std::vector<std::string>* fileNames);
|
|
private:
|
|
int FtpUploadWin(const char* ip, const char* localPathName, const char* uploadPathName);
|
|
int FtpDownloadWin(const char* ip, const char* LocalPathName, const char* downPathName);
|
|
int FtpGetFileListWin(const char* ip, const char* filePath, std::vector<std::string>* fileNames);
|
|
|
|
int FtpUploadLin(const char* ip, const char* localPathName, const char* uploadPathName);
|
|
int FtpDownloadLin(const char* ip, const char* LocalPathName, const char* downPathName);
|
|
int FtpGetFileListLin(const char* ip, const char* filePath, std::vector<std::string>* fileNames);
|
|
|
|
|
|
private:
|
|
int ftpServerProt_m_;
|
|
char* ftpUserName_m_;
|
|
char* ftpUserPwd_m_;
|
|
#ifdef _WIN32
|
|
char* szAppname_m_;
|
|
char* szUsername_m_;
|
|
char* szPassword_m_;
|
|
#else
|
|
#endif // _WIN32
|
|
};
|
|
|