Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.1k views
in .NET FTP by
Hi, this throws error: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Dim ftp as FTPClient = New FTPClient(_Host)
ftp.login(_Username, _Password)
ftp.ConnectMode = FTPConnectMode.PASV
ftp.transfertype = FTPTransferType.BINARY
If _Directory.length > 0 Then ftp.chdir(_Directory)
Dim r as Report
For Each r in Reports
ftp.put( r.GetReport, r.GetFileName )
Next r
ftp.quit

I've hooked up the logger, and it shows the BINARY command performed, THEN PASV, then nothing (Yes, out of order). It doesn't show the put command. Here's the debug text:

DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 3 Feb 2005 15:31:46.218 : Connecting to (IPADDRESS):(PORT)
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.281 : 220 nthosting2 Microsoft FTP Service (Version 5.0).
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.281 : ---> USER (USERNAME
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.343 : 331 Password required for (USERNAME).
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.343 : ---> PASS ********
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.359 : 230 User (USERNAME) logged in.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.359 : ---> TYPE I
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.390 : 200 Type set to I.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.390 : ---> PASV
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 3 Feb 2005 15:31:46.406 : 227 Entering Passive Mode ((IPADDRESS),11,205).

By the way, I run FileAppender.Close in the Finally block of Try, because the file remains open otherwise. But then the next time I run the code, it can't re-open the file. Here's that error:

System.ObjectDisposedException: Cannot write to a closed TextWriter.

Help please.

1 Answer

0 votes
by (162k points)
So what is a Report & what does r.GetReport return?

Categories

...