|
@@ -10,13 +10,12 @@
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 使用CURL进行FTP操作,这个类有两种方式,一种是直接使用静态方法,另一种是创建实例
|
|
|
- * 使用静态函数可以进行一些简单的操作,但是如果需要进行多次操作,最好创建实例
|
|
|
+ * 使用CURL进行FTP操作,这里是单线程的,需要多线程同时操作,就创建多个实例
|
|
|
*
|
|
|
- * 1.默认超时时间是10s
|
|
|
+ * 1.默认超时时间是30s
|
|
|
* 2.默认端口是21
|
|
|
* 3.设置好IP和端口号后,后续输入的文件路径都是想对你路径,无需添加IP和端口号
|
|
|
- *
|
|
|
+ * 4.使用ftp,用setFtpIPAndPort()设置IP和端口,使用sftp,用setSftpIPAndPort()设置IP和端口
|
|
|
*/
|
|
|
|
|
|
|
|
@@ -25,20 +24,14 @@ class CurlFtp
|
|
|
public:
|
|
|
CurlFtp();
|
|
|
~CurlFtp();
|
|
|
- // /* 列出FTP文件夹 */
|
|
|
- // static std::string listDir(const std::string &ftpUrl, const std::string &username, const std::string &password);
|
|
|
- // /* 列出文件夹中的所有文件 */
|
|
|
- // static bool listFiles(const std::string &ftpUrl, const std::string &username, const std::string &password, std::vector<std::string>& fileList);
|
|
|
- // /* 创建文件夹 */
|
|
|
- // static bool createDir(const std::string &ftpUrl, const std::string &username, const std::string &password, const std::string &dirName);
|
|
|
|
|
|
/*********************** 成员函数 *********************/
|
|
|
/* 设置用户名和密码 */
|
|
|
bool setUsernameAndPassword(const std::string& username, const std::string& password);
|
|
|
/* 设置IP和端口 */
|
|
|
- bool setFtpIPAndPort(const std::string& IP, const int port);
|
|
|
+ bool setFtpIPAndPort(const std::string& IP, const int port = 21);
|
|
|
/* 设置SFTP的IP和端口 */
|
|
|
- bool setSftpIPAndPort(const std::string& IP, const int port);
|
|
|
+ bool setSftpIPAndPort(const std::string& IP, const int port = 22);
|
|
|
/* 设置是否忽略SSL证书,使用SFTP不建议忽略 */
|
|
|
void setIgnoreSSLCert(bool isIgnore);
|
|
|
/* 设置CA证书文件 */
|