我正在尝试编写一个应用程序,它适用于ftp服务器上的文件。我需要在一个ftp连接中打开几个文件。我做这个
CInternetSession session(_T("Session1"));
CFtpConnection* pConnect = NULL;
CInternetFile* pFile1;
CInternetFile* pFile2;
pConnect = session.GetFtpConnection(_T("10.0.172.113"), _T("user11"), _T("12345"));
pFile1 = pConnect->OpenFile(L"folder1\\1.txt",GENERIC_WRITE,FTP_TRANSFER_TYPE_BINARY);
pFile2 = pConnect->OpenFile(L"folder1\\2.txt",GENERIC_READ,FTP_TRANSFER_TYPE_BINARY);
pConnect->Close();但是打开2.txt引发异常。有没有一种方法可以打开两个文件而不创建一个新的ftp连接?
发布于 2013-05-31 12:45:02
不,不可能http://msdn.microsoft.com/library/vstudio/1st6z7sc.aspx
调用OpenFile之后,直到调用CInternetConnection::Close,应用程序只能调用CInternetFile::Read,CInternetFile::call,CInternetConnection::Close,或CFtpFileFind::FindFile。对同一FTP会话的其他FTP函数的调用将失败,并将错误代码设置为FTP_ETRANSFER_IN_PROGRESS。
https://stackoverflow.com/questions/16857537
复制相似问题