本文整理汇总了C++中stream::plunder方法的典型用法代码示例。如果您正苦于以下问题:C++ stream::plunder方法的具体用法?C++ stream::plunder怎么用?C++ stream::plunder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stream
的用法示例。
在下文中一共展示了stream::plunder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: size
ftp_client::response
ftp_client::get(const char* remotefile, stream& ostream) const
{
response rsp;
if (!ostream.writable())
{
rsp.status[0] = 0;
rsp.detail = "Invalid output stream.";
return rsp;
}
rsp = size(remotefile);
if (rsp.status[0] != '2')
return rsp;
unsigned long total = atol(rsp.detail.c_str());
tcp_stream tcp = impl_->create_tcp_stream_from_pasv();
if (!tcp.readable())
{
rsp.status[0] = 0;
rsp.detail = "Create retr data connection failed.";
return rsp;
}
rsp = sendcmd("RETR %s", remotefile);
if (rsp.status[0] != '1')
return rsp;
unsigned long getted = ostream.plunder(tcp);
if (getted != total)
{
rsp.status[0] = 0;
rsp.detail = stralgo::format("getted/total: %ld/%ld", getted, total);
return rsp;
}
return impl_->get_response();
}
示例2: list
ftp_client::response ftp_client::list(const char* path, stream& ostream) const
{
response rsp;
tcp_stream tcp = impl_->create_tcp_stream_from_pasv();
if (!tcp.readable())
{
rsp.status[0] = 0;
rsp.detail = "Create list data connection failed.";
return rsp;
}
if (path)
rsp = sendcmd("LIST %s", path);
else
rsp = sendcmd("LIST");
if (rsp.status[0] != '1')
return rsp;
ostream.plunder(tcp);
return impl_->get_response();
}