4

I should be able to successfully send and receive file to/from FTP server.

But then, no changes occurred in the code and I started getting this :

Error: java.net.ConnectException: Connection timed out: connect

What I am doing is:

FTPClient ftp = new FTPClient();

ftp.connect( IPADDRESS of FTP server);

connect() is giving this execption. I am not understanding the cause for it.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Sagar
  • 1,727
  • 4
  • 22
  • 30

2 Answers2

2

The error message is telling you that the OS's attempt to connect to the server timed out. This typically means that:

  • the remote server has dropped off the network, or
  • something (e.g. a firewall) is "black holing" packets sent to the server on the FTP port.
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the connection was refused remotely (e.g., no process is listening on the remote address/port).

Source: JavaDoc.

Epaga
  • 38,231
  • 58
  • 157
  • 245