Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.9k views
in .NET FTP by
EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String expectedReplyCode)
at EnterpriseDT.Net.Ftp.FTPControlSocket.Initialize(BaseSocket sock, IPAddress remoteHost, Int32 controlPort, Int32 timeout)
at EnterpriseDT.Net.Ftp.FTPControlSocket..ctor(IPAddress remoteHost, Int32 controlPort, Int32 timeout)
at EnterpriseDT.Net.Ftp.FTPClient.Connect(IPAddress remoteAddr, Int32 controlPort, Int32 timeout)
at EnterpriseDT.Net.Ftp.FTPClient..ctor(IPAddress remoteAddr, Int32 controlPort, Int32 timeout)
at EnterpriseDT.Net.Ftp.FTPClient..ctor(String remoteHost)
at Karmanos.ERP.Components.ERPRemoteFileMonitor.LoginToFTP(String Identifier) in c:\documents and settings\feslerj\my documents\visual studio projects\erp\remotefilemonitor\erpremotefilemonitor.cs:line 130
at Karmanos.ERP.Components.ERPRemoteFileMonitor.ERPStart() in c:\documents and settings\feslerj\my documents\visual studio projects\erp\remotefilemonitor\erpremotefilemonitor.cs:line 42

Is the stack trace, the exception message is a single space. Line 130 of my program is:

130 myFTP = new EnterpriseDT.Net.Ftp.FTPClient(ftpClient);

ftpClient is a string

Whats happening is I have a continuous while loop that calls 130 every X amount of time which could be 30 seconds or 15 minutes.

I then replaced 130 to reset the remote host, and reconnect via:

myFTP.RemoteHost = ftpClient
myFTP.Connect()

and called FTPClient's new method only once at the beginning of the loop.

The problem is after some time the exception gets thrown. I need to reconnect each time as per the requirments, I was thinking of only reconnecting if the old remote host was different then the new but I don't think that would completely solve the problem (if I had two alternating connections for example). Can you give me more detail as to whats happening inside? Could you at least fix it so it gives you a message in the exception?

4 Answers

0 votes
by (162k points)
Are you calling quit() at any point?
0 votes
by
Yes
0 votes
by
I should clarify, every time the loop iterates, it calls quit.
0 votes
by (162k points)
I'm a little confused.

Is the exception getting thrown with:

myFTP = new EnterpriseDT.Net.Ftp.FTPClient(ftpClient);

or with

myFTP.RemoteHost = ftpClient
myFTP.Connect()

or in both cases?

Categories

...