Welcome! and rules
Joel on Software
Problem in FTP connection behind proxy
I'm trying to write a function that connect to an FTP sever via a proxy.
I use the following code :
lgSession = InternetOpen("FTP connection", INTERNET_OPEN_TYPE_PROXY, proxyname, vbNullString, 0)
If lgSession Then
lgInternet = InternetOpenUrl (lgSession, "ftp://servername/filename.doc", vbNullString, 0, INTERNET_FLAG_NO_CACHE_WRITE, 0)
If lgInternet Then
inRes = InternetReadFile(lgInternet, stBuf, 1024, lgRet)
Loop While (lgRet <> 0)
inRes = InternetCloseHandle(lgInternet)
But, i have always variable "inRes" equal to zero.
When I use explorer with ftp://servername/filename.doc, the file is downloaded correctly, but when using the code, no success to read the file.
Anybody know the problem.
Tuesday, November 23, 2004
Not sure what the API calls mean, but if you're setting up a default FTP connection, you may very well get proxy problems when the remote host tries to establish the FTP data channel back to your machine.
If this is the case, you could try setting up a passive FTP connection. I'm not sure what the appropriate API calls are for this, but it should be apparent from the documentation
Using passive FTP means that there is no separate data channel. All data moves through the control channel established outbound from your machine.
If you can surf, this should work. Unless the FTP port is blocked.....
Hope it helps
Tuesday, November 30, 2004
Fog Creek Home