本文整理汇总了C++中FTPException函数的典型用法代码示例。如果您正苦于以下问题:C++ FTPException函数的具体用法?C++ FTPException怎么用?C++ FTPException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FTPException函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DialogSocket
void FTPClientSession::login(const std::string& username, const std::string& password)
{
if (_isLoggedIn) logout();
int status = FTP_POSITIVE_COMPLETION * 100;
std::string response;
if (!_pControlSocket)
{
_pControlSocket = new DialogSocket(SocketAddress(_host, _port));
_pControlSocket->setReceiveTimeout(_timeout);
}
if (!_serverReady)
{
status = _pControlSocket->receiveStatusMessage(response);
if (!isPositiveCompletion(status))
throw FTPException("Cannot login to server", response, status);
_serverReady = true;
}
status = sendCommand("USER", username, response);
if (isPositiveIntermediate(status))
status = sendCommand("PASS", password, response);
if (!isPositiveCompletion(status))
throw FTPException("Login denied", response, status);
setFileType(_fileType);
_isLoggedIn = true;
}
开发者ID:macchina-io,项目名称:macchina.io,代码行数:30,代码来源:FTPClientSession.cpp
示例2: sendCommand
void FTPClientSession::rename(const std::string& oldName, const std::string& newName)
{
std::string response;
int status = sendCommand("RNFR", oldName, response);
if (!isPositiveIntermediate(status)) throw FTPException(std::string("Cannot rename ") + oldName, response, status);
status = sendCommand("RNTO", newName, response);
if (!isPositiveCompletion(status)) throw FTPException(std::string("Cannot rename to ") + newName, response, status);
}
开发者ID:119,项目名称:vdc,代码行数:8,代码来源:FTPClientSession.cpp
示例3: server
StreamSocket FTPClientSession::activeDataConnection(const std::string& command, const std::string& arg)
{
ServerSocket server(SocketAddress(_controlSocket.address().host(), 0));
sendPortCommand(server.address());
std::string response;
int status = sendCommand(command, arg, response);
if (!isPositivePreliminary(status)) throw FTPException(command + " command failed", response, status);
if (server.poll(_timeout, Socket::SELECT_READ))
return server.acceptConnection();
else
throw FTPException("The server has not initiated a data connection");
}
开发者ID:119,项目名称:vdc,代码行数:12,代码来源:FTPClientSession.cpp
示例4: FTPException
void FTPClientSession::abort()
{
if (!isOpen())
throw FTPException("Connection is closed.");
_pControlSocket->sendByte(DialogSocket::TELNET_IP);
_pControlSocket->synch();
std::string response;
int status = sendCommand("ABOR", response);
if (status == 426)
status = _pControlSocket->receiveStatusMessage(response);
if (status != 226)
throw FTPException("Cannot abort transfer", response, status);
}
开发者ID:macchina-io,项目名称:macchina.io,代码行数:14,代码来源:FTPClientSession.cpp
示例5: sendCommand
void FTPClientSession::removeDirectory(const std::string& path)
{
std::string response;
int status = sendCommand("RMD", path, response);
if (!isPositiveCompletion(status))
throw FTPException(std::string("Cannot remove directory ") + path, response, status);
}
开发者ID:macchina-io,项目名称:macchina.io,代码行数:7,代码来源:FTPClientSession.cpp
示例6: sa
StreamSocket FTPClientSession::passiveDataConnection(const std::string& command, const std::string& arg)
{
SocketAddress sa(sendPassiveCommand());
StreamSocket sock(sa);
std::string response;
int status = sendCommand(command, arg, response);
if (!isPositivePreliminary(status)) throw FTPException(command + " command failed", response, status);
return sock;
}
开发者ID:119,项目名称:vdc,代码行数:9,代码来源:FTPClientSession.cpp
示例7: endTransfer
void FTPClientSession::endTransfer()
{
if (_pDataStream)
{
delete _pDataStream;
_pDataStream = 0;
std::string response;
int status = _controlSocket.receiveStatusMessage(response);
if (!isPositiveCompletion(status)) throw FTPException("Data transfer failed", response, status);
}
}
开发者ID:119,项目名称:vdc,代码行数:11,代码来源:FTPClientSession.cpp
示例8: arg
void FTPClientSession::sendPORT(const SocketAddress& addr)
{
std::string arg(addr.host().toString());
for (std::string::iterator it = arg.begin(); it != arg.end(); ++it)
{
if (*it == '.') *it = ',';
}
arg += ',';
Poco::UInt16 port = addr.port();
arg += NumberFormatter::format(port/256);
arg += ',';
arg += NumberFormatter::format(port % 256);
std::string response;
int status = sendCommand("PORT", arg, response);
if (!isPositiveCompletion(status)) throw FTPException("PORT command failed", response, status);
}
开发者ID:119,项目名称:vdc,代码行数:16,代码来源:FTPClientSession.cpp
示例9: splitUserInfo
void FTPStreamFactory::getUserInfo(const URI& uri, std::string& username, std::string& password)
{
splitUserInfo(uri.getUserInfo(), username, password);
if (username.empty())
{
username = "anonymous";
password = _anonymousPassword;
}
else if (password.empty())
{
if (_pPasswordProvider)
password = _pPasswordProvider->password(username, uri.getHost());
else
throw FTPException(std::string("Password required for ") + username + "@" + uri.getHost());
}
}
开发者ID:12307,项目名称:poco,代码行数:16,代码来源:FTPStreamFactory.cpp
示例10: sendCommand
void FTPClientSession::remove(const std::string& path)
{
std::string response;
int status = sendCommand("DELE", path, response);
if (!isPositiveCompletion(status)) throw FTPException(std::string("Cannot remove " + path), response);
}
开发者ID:Victorcasas,项目名称:georest,代码行数:6,代码来源:FTPClientSession.cpp
注:本文中的FTPException函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论