Problem with CFTPConnection
I've an application that connects to an FTP Server and uploads a big
directory (size over 500 MB). Now what happens is that after sometime the
application stops uploading files and stays idle. The FTP server connection
timeout value is set to 2 minutes. So the server seeing the connection idle
for two seconds, disconnect the session and no more file is uploaded. On
debugging I found out that after some time CFTPConnection.PutFile() method
hangs on some random file and stays like that for 5 minutes (default send
timeout value of CFTPSession). During this time the server connection
timeo...Use of CFtpConnection and caching
Am using CInternetSession and CFtpConnection in a simple program, it
works fine, but I have problems regarding caching (I think) when getting
a file (with CFtpConnection::GetFile()).
If the remote file changes while my program runs, I only read the same
old version. Even if I delete the remote file, I can still read it, seem
like some kind of caching along the way.
I have created the CInternetSession object with flag
INTERNET_FLAG_DONT_CACHE (this is the argument list to the constructor)
(NULL, 1, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL,
INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_NO_CAC...CFtpConnection and AS400
We are using CFtpConnection class to upload data onto a
file in an FTP. Everything works fine when we upload to a
Windows FTP but we are having problems when using an FTP
site on AS400. The file seems to be uploaded correctly
but the location where the file is stored is not the same
location when the command prompt ftp command is used to
upload a file and we are having problems locating the file
since we are told that it is being stored inside the
We tried using the FTPTree sample to browse the FTP site
but with AS400 we are unable to browse through subfolder...use CFtpConnection on very slow connection
I have used CFtpConnection to transfer files. It works in most condition but
breaks when the connection is very slow. Any one know some article referring
how to use this on very slow connection?
Also I open several thread when transfer, every thread has a different
CFtpConnection. I found I could only open 2 thread at max. Anyone knows how
to open 4-5 thread?
Thank you a lot
how can I make CFtpConnection::PutFile to terminate after some time regarding
of the status of the transfer?
I am looking for how to control the ftp operations so that they do not take
longer than certain time.
I have the option of doing them on a separate thread but, is there a way of
doing with the CFtpConnection object itself?
"beluchin" <firstname.lastname@example.org> wrote in message
> how can I make CFtpConnection::PutFile to terminate after some time
> of the status of ...CFtpConnection::PutFile and ProgressBarCtrl
I am using the CFtpConnection::PutFile and GetFile for transfering files
between my local pc and the ftp server. In need to put a progress bar for
indicating the size uploaded or downloaded.
In msdn helps it says that CInternetSession::OnCallBackStatus can be used to
achive this. But How to use it?? Can anyone help me to sort out this..
Call EnableStatusCallback() to enable this. Override OnStatusCallback() in your class derived from
"Balaji" <Balaji@discussions.microsoft.com> wrote in message
news:C2E1816E-9FD1-4B3F-B89A-D929F46B7CEA@micros...Unknown error from CFtpConnection::GetFile()...
I'm having intermittent problems with CFtpConnection::GetFile()...
99% of the time GetFile() succeeds but occasionally it fails and returns
FALSE with a GetLastError of 0x2EFF (12031) which I can't find
Anyone know what this error means...? Where it is defined...?
A bit of searching on on the web seems to suggest; "The connection with the
server has been reset."
Can anyone confirm this...?
Andrew Kilgore wrote:
> Hi all,
> I'm having intermittent problems with CFtpConnection::GetFile()...
> 99%...Detecting closed connection when calling CFtpConnection::PutFile
An open ftp connection can be closed due to inactivity. How to detect that
situation given a failed call to CFtpConnection::PutFile?
That is, I have an app that opens an ftp connection and never closes it
(intentionally, for performance reasons). The app then calls
CFtpConnection::PutFile. However, due to inactivity, the connection may be
closed from underneath the app. In that case, I tested, the call to PutFile
How to reliably detect that the failure is due to inactivity in which case
the app would reopen the connection and try again?
"beluchin" <beluchin@discuss...CFtpConnection::OpenFile(...) Timeout
Tim explained to me why OpenFile might return an error if the server is
behind a router.
But, because I still want to give the user options, (and because I don't
think we will always be behind a router).
But if the user choose the wrong option, sometime the OpenFile(...) hangs
for 4/5 minutes, (if not longer).
OnStatusCallback(...) does not really help, All I get is
INTERNET_STATUS_HANDLE_CREATED first and then nothing.
So how can I either test for connection or change the timeout for
I just cannot have my application stuck for so long every time.
Sim...CFtpConnection locks program
I have recently inherited a program that uses FTP.
Most of the time, the program seems to work correctly.
However, at times, the program locks - up.
There is NO error message, but the entire user interface is unresponsive.
CODE SNIPPET BELOW.
(Some of the called functions are tied to the interface (child windows),
It seems that this is the case but I want to be sure given my limited (but
increasing) knowledge of FTP.
While debugging, I found that I can recreate this problem (lock-up) by
disconnecting the network cable from the Ftp server where files are being
If I r...CFtpFileFind messes with CFtpConnection; Error 12003
I have an vxWorks FTP server running. I want to transfer a file to
that server, but before transfering it I want to check if the file
already exists, so the user can decide whether he wants to overwrite
I use CFtpFileFind to check if the file on the server alredy exists.
Then I use CInternetFile to open the file, and write it on the server.
This sometimes works, but sometimes CInternetFile::Open throws an
CInternetException with m_dwError = 12003 ("The server returned
extended information") and CInternetFile::GetErrorMessage returns "200
Type set to I, binary...problem with CFtpConnection
I have a little problem with class CFtpConnection.
I create internet session, then from it ftp connection (as described
in msdn). ... ok - when is ftp connection establishing, program
creates new 3 threads.
But when i close and delete the FtpConnection and InternetSession the
three threads are not terminated and remain in the process. (Now when
i connect and disconnect again, there are again only the same 3
threads that there were before)
Could anyone help me? I'd like to keep the aplication same as before
connecting ... (or are it some working threads from loaded modules?)
the...CFtpConnection : connection closed by the server
I have a little FTP client, using CFtpConnection, and I have a problem
: I connect to the server, then perform some operations, but after a
given time, the server close the connection. I tried to detect it using
OnInternetStatusCallback, and INTERNET_STATUS_CLOSING_CONNECTION, but
this function isn't called neither when I close the connection myself
nor when it's the server that close the connection. The function is
called for other events, like connection, receiving data, but not on
this event. I does not understand.
Please help me. If you have some working code, I w...cftpconnect.gefile() error=12003 ?
I get lastError code = 12003 from when trying GetFile() as follows-
Could you tell me what is the error for this code and how to fix it.
--my code :
CInternetSession sess( _T("mysite"), 1, PRE_CONFIG_INTERNET_ACCESS);
CFtpConnection* pConnect = NULL ;
sess.GetFtpConnection( _T("ftp.mysite.com") , _T("me") , _T("pwd") ) ;}
if( ! pConnect->GetFile( _T("bcu.txt") , _T("c:\\tou.txt") , FALSE ) )
DWORD dw = GetLastError();
Check out my essay on my MVP Tips site on how to decode these errors. I don't know wh...HELP! CFtpConnection GetFile cause memory leaking, WHY?
I'm trying to use CFtpConnection GetFile to download files from a
WS_FTP server. I found if I download 1000 files (Size from 17KB to
25KB ), it can cause about 10M memory leaking. When I commented out
the GetFile( ) line, there was no memorry leaking. WHY?
Following is part of my source code:
// Request a connection to Image
//Use default FTP Port
//Use Passive MODE
sess.GetFtpConnection(strISIP,strFtpUser,...CFtpConnection::PutFile never return under debugger
When I use this function CFtpConnection::PutFile under a debugger it doesn't
return forever. If I use another file as an argument(smaller and probably
binary) it returns and does its job.
Can someone advise?
...CFtpConnection::PutFile only creating 0 length file on server
hey guys, i recently made a tiny app using the MFC class CFtpConnection that
is sending files to an AS/400 server. its been working consistently for a few
months now with no problems. but in the last couple of weeks its been
failing. during the method PutFile(), it would set the transfer type to ASCII
and it would try to put the file on the server, but it only creates a 0
length file with the appropriate filename and timesout (usually after like 3
minutes or so) with a bad return code.
ive googled it in groups and have found similar cases where this function
was doing the same thing bu...PutFile takes forever...
I have a problem with the following piece of code. At home, this works
fine. But at my job, the firewall is badly configured at the moment.
As a result we can not properly usde FTP.
In the following code example, the GetFtpConnection takes a while, but
succeeds. pFtp gets a valid value. SetCurrentDirectory goes fine too.
But PutFile takes forever. It just hangs there.
I know the firewall is badly configured, but that shouldn't result in
my program hanging. Is there a way to use some kind of timeout? Maybe
CFtpConnection* pFtp = NULL;
Hi, This is a code I wrote which gives me the mentioned error on the
pFtpConnection = sess.GetFtpConnection(pSutData->SutIP(),
//bla bla bla
DWORD dw = strFileMode == ASCII ? FTP_TRANSFER_TYPE_ASCII :
//2 CStrings and 1 DWORD as parameters -->