91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 6KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-16
  • 語言: C/C++
  • 標簽: FTP??上傳??下載??

資源簡介

非常好用的FTP文件上傳和下載等管理類,可輕松移植到你的C++程序中,目前已經應用于我們項目中。這個類適用于windows環境下

資源截圖

代碼片段和文件信息

/*******************************************************
Copyright?2014-2016??xhl?Co.?Ltd.?
文??件: FTPManager.cpp
開發單位:
編??寫: XHL
日??期: 2015.04
描??述: FTP文件上傳下載管理文件
修??改:
********************************************************/

#include?“stdafx.h“
#include?“FTPManager.h“

static?int?SplitString(?std::string?strSrc?std::list?&strArray??std::string?strFlag)
{
int?pos?=?1;?

while((pos?=?(int)strSrc.find_first_of(strFlag.c_str()))?>?0)?
{
strArray.insert(strArray.end()?strSrc.substr(0??pos));
strSrc?=?strSrc.substr(pos?+?1?strSrc.length()?-?pos?-?1);?
}

strArray.insert(strArray.end()?strSrc.substr(0?strSrc.length()));

return?0;?
}

CFTPManager::CFTPManager(void):?m_bLogin(false)
{
m_cmdSocket?=?socket(AF_INET?SOCK_STREAM?0);
}

CFTPManager::~CFTPManager(void)
{
std::string?strCmdLine?=?parseCommand(FTP_COMMAND_QUIT?““);

Send(m_cmdSocket?strCmdLine.c_str());
closesocket(m_cmdSocket);
m_bLogin?=?false;
}

FTP_API?CFTPManager::login2Server(const?std::string?&serverIP)
{
std::string?strPort;
int?pos?=?serverIP.find_first_of(“:“);

if?(pos?>?0)
{
strPort?=?serverIP.substr(pos?+?1?serverIP.length()?-?pos);
}
else
{
pos?=?serverIP.length();
strPort?=?FTP_DEFAULT_PORT;
}

m_strServerIP?=?serverIP.substr(0?pos);
m_nServerPort?=?atol(strPort.c_str());

trace(“IP:?%s?port:?%d\n“?m_strServerIP.c_str()?m_nServerPort);

if?(Connect(m_cmdSocket?m_strServerIP?m_nServerPort)? {

return?-1;
}

m_strResponse?=?serverResponse(m_cmdSocket);
printf(“@@@@Response:?%s“?m_strResponse.c_str());

return parseResponse(m_strResponse);
}

FTP_API?CFTPManager::login2Server(const?std::string?&serverIPconst?std::string?&serverPor)
{
std::string?strPort;
int?pos?=?serverIP.find_first_of(“:“);

if?(pos?>?0)
{
strPort?=?serverIP.substr(pos?+?1?serverIP.length()?-?pos);
}
else
{
pos?=?serverIP.length();
strPort?=?serverPor;
}

m_strServerIP?=?serverIP.substr(0?pos);
m_nServerPort?=?atol(strPort.c_str());

trace(“IP:?%s?port:?%d\n“?m_strServerIP.c_str()?m_nServerPort);

if?(Connect(m_cmdSocket?m_strServerIP?m_nServerPort)? {

return?-1;
}

m_strResponse?=?serverResponse(m_cmdSocket);
printf(“@@@@Response:?%s“?m_strResponse.c_str());

return parseResponse(m_strResponse);
}

FTP_API?CFTPManager::inputUserName(const?std::string?&userName)
{
std::string?strCommandLine?=?parseCommand(FTP_COMMAND_USERNAME?userName);

m_strUserName?=?userName;

if?(Send(m_cmdSocket?strCommandLine)? {
return?-1;
}

m_strResponse?=?serverResponse(m_cmdSocket);
printf(“Response:?%s\n“?m_strResponse.c_str());

return?parseResponse(m_strResponse);
}

FTP_API?CFTPManager::inputPassWord(const?std::string?&password)
{
std::string?strCmdLine?=?parseCommand(FTP_COMMAND_PASSWORD?password);

m_strPassWord?=?password;
if?(Send(m_cmdSocket?strCmdLine)?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????18272??2015-04-10?15:02??FTPManager.cpp

?????文件???????5583??2015-04-10?08:55??FTPManager.h

-----------?---------??----------?-----??----

????????????????23855????????????????????2


評論

共有 條評論