You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by ML...@parkseed.com on 2004/10/12 17:54:41 UTC
ftp connection exception
Folks,
I'm trying to use ftp.java to connect to a client. It worked once fine. But
after it gives me connection refused exception. But the ftp server is up. I
tried connecting using ftp lite and other ftp softwares. IT works. Why this
doesn't work?
Any ideas....
Madhan.
try
{
int reply;
ftp.connect(server);
ftp.enterLocalPassiveMode();
System.out.println("Connected to ftp " + server + ".");
// After connection attempt, you should check the reply code to
verify
// success.
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply))
{
ftp.disconnect();
System.out.println("FTP server refused connection.");
System.exit(1);
}
}
catch (IOException e)
{
e.printStackTrace();
if (ftp.isConnected())
{
try
{
ftp.disconnect();
}
catch (IOException f)
{
//Log.printwarningln("Error while disconnecting");
}
}
System.out.println(new java.util.Date() + "Could not connect to
ftp server.");
System.exit(1);
}
Madhan Lakshmanan(Maddy)
Park Seed Inc
864-941-4232
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org