Reputation: 486
I'm trying to write an aplication, that works with files on ftp server. I need to open several files in one ftp connection. I do this
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();
But opening 2.txt thrown exception. Is there a way to open two files without creating a new ftp connection?
Upvotes: 1
Views: 864
Reputation: 13984
No, no way http://msdn.microsoft.com/library/vstudio/1st6z7sc.aspx:
After calling OpenFile and until calling CInternetConnection::Close, the application can only call CInternetFile::Read, CInternetFile::Write, CInternetConnection::Close, or CFtpFileFind::FindFile. Calls to other FTP functions for the same FTP session will fail and set the error code to FTP_ETRANSFER_IN_PROGRESS.
Upvotes: 1