How exactly is it not working? Does the site require a login with username and password? Can you be more specific about your problem?
Joined: Dec 23, 2000
Hi maateen, It's giving java.net.exception: connection refused: No further information..
I'm also tried for FTP servlet.. But not get How to write FTP servlet??? Do you have any Idea about FTP servlet??? Thanx
Joined: Sep 30, 2000
Hi sunil You say that java.net.exception is displayed, but there is NO class named java.net.exception or java.net.Exception in the java.net package. The only exceptions in java.net package are:- BindException, ConnectException, MalformedURLException, NoRouteToHostException, ProtocolException, SocketException, UnknownHostException, UnknownServiceException So which exactly is the exception thrown? Solving the problem without specific information is difficult. Also, if your ftp server-site requires a username, password, then the first command that should be sent over the socket is a login command supplying the username and password. That may be the reason why GET causes connection refused message. You can also use URL or URLConnection class to download from the ftp site. The code is much simpler:- URL url=new URL(protocol:resource); InputStream uin=url.openStream(); ... If the site requires username and password then do as follows:- URL url=new URL("ftp://username :email@example.com/pub/file.txt");
[This message has been edited by Rahul Rathore (edited March 15, 2001).]