Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.4k views
in .NET FTP by (260 points)
Hello,

On some ftp-servers i got the error message, on others not. The code is ervy time the same:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Ftp As New EnterpriseDT.Net.Ftp.FTPConnection

Ftp.Timeout = 120
Ftp.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.PASV
Ftp.ServerAddress = "x.x.x.x"
Ftp.ServerPort = "21"
Ftp.UserName = "xxx"
Ftp.Password = "xxx"

Try
Ftp.Connect()
Ftp.Login()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Ftp.Close()

End Sub

Is there any solution? thx.

Bruce

4 Answers

0 votes
by
Hi Bruce

Could you please enable logging (see Developer's Guide) and post the relevant parts of the log?

- Hans (EDT)
0 votes
by (260 points)
I added the debug code in this way:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Ftp As New EnterpriseDT.Net.Ftp.FTPConnection

Dim log As Logger = Logger.GetLogger(GetType(Form1))
Logger.CurrentLevel = Level.DEBUG
log.AddAppender(New FileAppender("d:\test_ftp.log"))

log.Info("start")

Ftp.Timeout = 120
Ftp.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.PASV
Ftp.ServerAddress = "x.x.x.x"
Ftp.ServerPort = "21"
Ftp.UserName = "xxx"
Ftp.Password = "xxx"

Try
Ftp.Connect()
Ftp.Login()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Ftp.Close()
log.Info("end")
End Sub




The Result-Log contains:


INFO [FTP_Test.Form1] 14 Dez 2005 13:38:02.794 : start
DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 14 Dez 2005 13:38:02.804 : Connecting to x.x.x.x:21
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.824 : 220 xxx FTP server ready.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.824 : ---> USER xxx
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.834 : 331 Password required for xxx.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.834 : ---> PASS ********
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.844 : 230 User xxx logged in. Access restrictions apply.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.844 : ---> TYPE I
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.844 : 200 Type set to I.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.844 : ---> USER xxx
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:02.844 : 530 Already logged in.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:04.266 : ---> QUIT
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:04.266 : 221-You have transferred 0 bytes in 0 files.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:04.276 : 221-Total traffic for this session was 256 bytes in 0 transfers.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:04.276 : 221-Thank you for using the FTP service on xxx.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 14 Dez 2005 13:38:04.276 : 221 Goodbye.
INFO [FTP_Test.Form1] 14 Dez 2005 13:38:04.276 : end
0 votes
by (162k points)
With FTPConnection there is auto login by default, so after Connect() you don't need to call Login().
0 votes
by (260 points)
thx so much for this solution, problem is sloved now!

Categories

...