Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.7k views
in .NET FTP by (340 points)
Hi,

I'm creating a specific Ftp client to do some specific tasks, but I'm having some issues. The edtftpnet hangs some time. I debugged and found that it hangs on the line "string line = reader.ReadLine()" in FTPControlSocket.cs:769.

Here is the eftftp.net debug:

DEBUG [HostNameResolver] 12 mar 2007 15:23:19.447 : ftpXXX resolved to XXX.XXX.XXX.XX
DEBUG [FTPClient] 12 mar 2007 15:23:19.463 : Connecting to XXX.XXX.XXX.XX:21
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.525 : 220 XXX Microsoft FTP Service (Version 5.0).
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.557 : ---> USER xxxxxxx
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.557 : 331 Password required for xxxxxxx.
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.557 : ---> PASS ********
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.572 : 230-Prezado Cliente, seja bem-vindo a xxxxx
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.697 : 230 User xxxxxxx logged in.
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.713 : ---> CWD /XXXXXXXX-logfiles/W3SVC6
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.713 : 250 CWD command successful.
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.728 : ---> PWD
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.728 : 257 "/XXXXXXXX-logfiles/W3SVC6" is current directory.
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.744 : ---> SYST
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.744 : 215 Windows_NT version 5.0
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.775 : ---> PASV
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.775 : 227 Entering Passive Mode (XXX,XXX,XXX,XX,XX,3).
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.775 : Server supplied address=XXX.XXX.XXX.XX
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.791 : Server supplied port=3331
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.791 : Substituting server supplied IP (XXX.XXX.XXX.XX) with remote host IP (XXX.XXX.XXX.XX)
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.791 : NewPassiveDataSocket(XXX.XXX.XXX.XX,3331)
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.807 : ---> LIST ex*
DEBUG [FTPControlSocket] 12 mar 2007 15:23:19.822 : 125 Data connection already open; Transfer starting.
DEBUG [FTPClient] 12 mar 2007 15:23:19.822 : -->-rwxrwxrwx 1 owner group 59157334 Feb 25 21:00 ex070225.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.822 : -->-rwxrwxrwx 1 owner group 90750851 Feb 26 21:00 ex070226.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.822 : -->-rwxrwxrwx 1 owner group 97695527 Feb 27 21:00 ex070227.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.838 : -->-rwxrwxrwx 1 owner group 135999542 Feb 28 21:00 ex070228.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.838 : -->-rwxrwxrwx 1 owner group 131527287 Mar 1 21:00 ex070301.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.838 : -->-rwxrwxrwx 1 owner group 103160499 Mar 2 21:00 ex070302.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.838 : -->-rwxrwxrwx 1 owner group 70707122 Mar 3 21:00 ex070303.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.853 : -->-rwxrwxrwx 1 owner group 71596829 Mar 4 21:00 ex070304.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.853 : -->-rwxrwxrwx 1 owner group 92208828 Mar 5 21:00 ex070305.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.853 : -->-rwxrwxrwx 1 owner group 105657624 Mar 6 21:00 ex070306.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.853 : -->-rwxrwxrwx 1 owner group 102393860 Mar 7 21:00 ex070307.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.869 : -->-rwxrwxrwx 1 owner group 94117818 Mar 8 21:00 ex070308.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.869 : -->-rwxrwxrwx 1 owner group 83323237 Mar 9 21:00 ex070309.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.869 : -->-rwxrwxrwx 1 owner group 63561761 Mar 10 21:00 ex070310.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.869 : -->-rwxrwxrwx 1 owner group 78003826 Mar 11 21:00 ex070311.log
DEBUG [FTPClient] 12 mar 2007 15:23:19.885 : -->-rwxrwxrwx 1 owner group 67043328 Mar 12 15:23 ex070312.log
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.025 : 226 Transfer complete.
DEBUG [FTPClient] 12 mar 2007 15:23:20.025 : Found 16 listing lines
DEBUG [FTPFileFactory] 12 mar 2007 15:23:20.025 : Parse() called using culture: Invariant Language (Invariant Country)
INFO [FTPFileFactory] 12 mar 2007 15:23:20.041 : Swapping Windows parser to Unix
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.213 : ---> TYPE I
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.228 : 200 Type set to I.
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.260 : ---> PASV
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.275 : 227 Entering Passive Mode (XXX,XXX,XXX,XX,13,4).
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.275 : Server supplied address=XXX.XXX.XXX.XX
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.291 : Server supplied port=3332
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.291 : Substituting server supplied IP (XXX.XXX.XXX.XX) with remote host IP (XXX.XXX.XXX.XX)
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.307 : NewPassiveDataSocket(XXX.XXX.XXX.XX,3332)
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.322 : ---> RETR ex070312.log
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.338 : 125 Data connection already open; Transfer starting.
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.400 : ---> CWD /XXXXXXXX-logfiles/W3SVC6


The problem looks to occur after I try do download a file from Ftp to a locked local file.


Any idea on how to fix this?

11 Answers

0 votes
by (162k points)
For some reason CWD (changing the working directory) is being called before the transfer is completed.

DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.338 : 125 Data connection already open; Transfer starting.
DEBUG [FTPControlSocket] 12 mar 2007 15:23:20.400 : ---> CWD /XXXXXXXX-logfiles/W3SVC6
0 votes
by (340 points)
Thanks!

For me makes some sense.

The lib tries to download the file. The local file already exists and is locked by another process. The lib catch the exception, but do not stop the transfer before continuing. The next issued command halts the lib.

Any idea on how to fix this on the lib?
0 votes
by (162k points)
Do you have a stack trace? What exception is being thrown?
0 votes
by (340 points)
The process cannot access the file '...' because it is being used by another process
0 votes
by (162k points)
If possible we need the stack trace and the class of the exception, e.g. IOException?
0 votes
by (340 points)
Here go. Processing "continues". Looks like the lib dont stop the transfer before issuing another command to FTP, and halts waiting for answer.
0 votes
by (340 points)
Message: The process cannot access the file 'c:\logfiles\morasha1\10emtudo\ex070312.log' because it is being used by ano
ther process.

Help Link:

Inner Exception:

Source: mscorlib

Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShar
e share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile) in C:\Documents and Settings\fischer
\My Documents\Visual Studio 2005\Projects\edtftpnet-1.2.4\src\net\ftp\FTPClient.cs:line 2295
at EnterpriseDT.Net.Ftp.FTPClient.Get(String localPath, String remoteFile) in C:\Documents and Settings\fischer\My Do
cuments\Visual Studio 2005\Projects\edtftpnet-1.2.4\src\net\ftp\FTPClient.cs:line 1978
at EnterpriseDT.Net.Ftp.FTPConnection.DownloadFile(String localPath, String remoteFile) in C:\Documents and Settings\
fischer\My Documents\Visual Studio 2005\Projects\edtftpnet-1.2.4\src\net\ftp\FTPConnection.cs:line 2225
at LwFtpClient.Program.DownloadFile(ConfigEntry ce, FTPFile file, DateTime LastModified, String lpath) in C:\Document
s and Settings\fischer\My Documents\Visual Studio 2005\Projects\LwFtpClient\LwFtpClient\Program.cs:line 842

Targe Site: Void WinIOError(Int32, System.String)

ToString(): System.IO.IOException: The process cannot access the file 'c:\logfiles\morasha1\10emtudo\ex070312.log' becau
se it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShar
e share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile) in C:\Documents and Settings\fischer
\My Documents\Visual Studio 2005\Projects\edtftpnet-1.2.4\src\net\ftp\FTPClient.cs:line 2295
at EnterpriseDT.Net.Ftp.FTPClient.Get(String localPath, String remoteFile) in C:\Documents and Settings\fischer\My Do
cuments\Visual Studio 2005\Projects\edtftpnet-1.2.4\src\net\ftp\FTPClient.cs:line 1978
at EnterpriseDT.Net.Ftp.FTPConnection.DownloadFile(String localPath, String remoteFile) in C:\Documents and Settings\
fischer\My Documents\Visual Studio 2005\Projects\edtftpnet-1.2.4\src\net\ftp\FTPConnection.cs:line 2225
at LwFtpClient.Program.DownloadFile(ConfigEntry ce, FTPFile file, DateTime LastModified, String lpath) in C:\Document
s and Settings\fischer\My Documents\Visual Studio 2005\Projects\LwFtpClient\LwFtpClient\Program.cs:line 842
0 votes
by (162k points)
Thanks, very useful. We'll take a look.
0 votes
by (162k points)
Please email support at enterprisedt dot com if you want to try out a fix.
0 votes
by (140 points)
I am having this exact same problem:

Basically, it hangs when FTPControlSocket.ReadReply() is called, but only on *some* ftp servers.

Can I obtain the fix for this?

Categories

...