Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.3k views
in Java FTP by (1k points)
Hi,
I'm using edtftpj free edition.
If I activate my firewall (as can be done in most PCs), my java code can connect to ftp server and also creates a given remote folder, but when i try to put() a file to ftp serer, it didn't got uploaded. I see in the console a message that says "Connection refused: connect".
can you please tell me how i can handle exceptions thrown due to firewalls ?
thanks.

here is the exception debug trace :
DEBUG [FTPClient] 14 jun 2008 10:52:05.968 : Connecting to ftp.elrevelado.com/89.17.210.90:21
DEBUG [SocketUtils] 14 jun 2008 10:52:05.968 : Invoking connect with timeout=60000
DEBUG [SocketUtils] 14 jun 2008 10:52:05.984 : Connected successfully
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.15 : 220 ProFTPD 1.3.0 Server (ProFTPD) [89.17.210.90]
DEBUG [com.arcadina.ftp.IFTPTransfer] 14 jun 2008 10:52:06.15 : Logging in...
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.15 : ---> USER ftptest
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.31 : 331 Password required for ftptest.
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.31 : ---> PASS ********
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.125 : 230 User ftptest logged in.
DEBUG [com.arcadina.ftp.IFTPTransfer] 14 jun 2008 10:52:06.125 : Connected to ftp.elrevelado.com.
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.125 : ---> TYPE I
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.140 : 200 Type set to I
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.140 : ---> MKD /order20080614
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.156 : 257 "/order20080614" - Directory successfully created
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.156 : ---> PASV
DEBUG [FTPControlSocket] 14 jun 2008 10:52:06.171 : 227 Entering Passive Mode (89,17,210,90,211,205).
ERROR [FTPClient] 14 jun 2008 10:52:07.250 : Caught and rethrowing exception in initPut() : Connection refused: connect
java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(Unknown Source)
   at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
   at java.net.PlainSocketImpl.connect(Unknown Source)
   at java.net.SocksSocketImpl.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at java.net.Socket.<init>(Unknown Source)
   at java.net.Socket.<init>(Unknown Source)
   at com.enterprisedt.net.ftp.FTPControlSocket.newPassiveDataSocket(FTPControlSocket.java:780)
   at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketPASV(FTPControlSocket.java:692)
   at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.java:485)
   at com.enterprisedt.net.ftp.FTPClient.setupDataSocket(FTPClient.java:2204)
   at com.enterprisedt.net.ftp.FTPClient.initPut(FTPClient.java:2239)
   at com.enterprisedt.net.ftp.FTPClient.putData(FTPClient.java:2322)
   at com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:2065)
   at com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:2035)
   at com.arcadina.ftp.SelectorFTPTransfer.run(SelectorFTPTransfer.java:106)

1 Answer

0 votes
by (162k points)
When you list a directory or transfer a file, a new connection is opened on a 'random' port. If your firewall does not understand FTP then it may not work. Try changing to active mode.

Categories

...