Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.6k views
in .NET FTP by (160 points)
I am having difficulty with a get operation. The code always passes through the .IsConnected OK but then fails in the Get with the error shown in the log. Any help would be appreciated. Thank you.

Code:

If objFTP.IsConnected Then
objFTP.Get(tLocalPath & tLocalFileName, tFileBeingDownloaded)
Else
FTPLogger.Debug("No Connection!!!")
Throw New Exception("No FTP Connection!!")
End If

Log:

DEBUG [HostNameResolver] 14 Jul 2008 17:12:54.999 : xxx.xxx.xxx.xxx resolved to xxx.xxx.xxx.xxx
DEBUG [FTPClient] 14 Jul 2008 17:12:54.999 : Connecting to xxx.xxx.xxx.xxx
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.030 : Setting socket timeout=120000
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.030 : Command encoding=System.Text.ASCIIEncoding
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.030 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.061 : 220 Authorized Use Only
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.061 : ---> USER *********
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.093 : 331 Password required for ***********
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.093 : ---> PASS ********
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.124 : 230 Logged on
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.124 : ---> TYPE I
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.155 : 200 Type set to I
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.155 : Setting socket timeout=5500000
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.155 : ---> PWD
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.186 : 257 "/" is current directory.
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.186 : ---> PWD
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.218 : 257 "/" is current directory.
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.218 : ---> CWD AllListings
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.233 : 250 CWD successful. "/AllListings" is current directory.
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.233 : ---> PWD
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.265 : 257 "/AllListings" is current directory.
DEBUG [DownloadFiles.clsFTP] 14 Jul 2008 17:12:55.265 : Downloading: /AllListings, CNIAllExtra.zip
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.265 : ---> SIZE CNIAllExtra.zip
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.296 : 213 66184174
DEBUG [DownloadFiles.clsFTP] 14 Jul 2008 17:12:55.296 : Connected status is True
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.311 : NewActiveDataSocket(0)
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.311 : ---> PORT 192,168,100,162,10,55
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.343 : 200 Port command successful
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.343 : ---> RETR CNIAllExtra.zip
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.374 : 150 Opening data channel for file transfer.
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:55.374 : Setting socket timeout=500
DEBUG [FTPControlSocket] 14 Jul 2008 17:12:56.405 : Setting socket timeout=5500000
ERROR [DownloadFiles.clsFTP] 14 Jul 2008 17:12:56.405 : Quit Error: : EnterpriseDT.Net.Ftp.FTPException: The FTP client has not yet connected to the server. The requested action cannot be performed until after a connection has been established.
EnterpriseDT.Net.Ftp.FTPException: The FTP client has not yet connected to the server. The requested action cannot be performed until after a connection has been established.
at EnterpriseDT.Net.Ftp.FTPClient.CheckConnection(Boolean shouldBeConnected)
at EnterpriseDT.Net.Ftp.FTPClient.Quit()
at DownloadFiles.clsFTP.FTPLogOff(FTPClient objFTP)

2 Answers

0 votes
by (162k points)
You are using active mode, and requesting that the server connect to your client on 192.168.100.162.

Unless the server is also on the same internal network, it won't be able to do so as this is an internal IP address.

If this is the case, you need to set the PublicIPAddress property to your external IP address and make sure connections to that address end up at your machine.

Otherwise switch to passive mode transfers.
0 votes
by (160 points)
The problem also occured with a Passive connection. I finally traced the issue to an invalid path for the local file name when making the GET call. :D

Categories

...