aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Problem in connecting to FTP server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Problem in connecting to FTP server" Watch "Problem in connecting to FTP server" New topic
Author

Problem in connecting to FTP server

Manupriya Sinha
Greenhorn

Joined: Aug 19, 2008
Posts: 4
Hi,

I am using apache commons library for connecting to FTP server. Please find below the code -

Now my problem is - I do not get any exception but still ftp.getReplyString() returns '530 Login incorrect.'. Can you please help me with this.

We are using port 22 on the ftp server. Can that be the reason for this error?

I modified my code and included port as well while connecting, as folllows -
ftp.connect(addr, 22);

but now I am getting an exception -
Server Reply: SSH-1.99-OpenSSH_3.6.1p2
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:284)
at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:335)
at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:550)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:142)
at com.novus.file.ftp.JakartaWrapperTest.main(JakartaWrapperTest.java:26)

Is it to do something with Active FTP or Passive FTP?

Thanks,
Manupriya

JCE - Please Use Code Tags
[ August 19, 2008: Message edited by: Joe Ess ]

Regards,<br />Manupriya<br /> <br />SCJP 1.4 - 98%<br />SCWCD 1.4 - 94%
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Originally posted by Manupriya Sinha:

Server Reply: SSH-1.99-OpenSSH_3.6.1p2


This reply leads me to believe that you are connecting to an SSH service, not FTP. Port 22 is usually bound to an SSH server. Port 21 is typical for an FTP server.
Have you tried connecting with an FTP client?
Are you supposed to be using SFTP (FTP over SSH)?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Manupriya Sinha
Greenhorn

Joined: Aug 19, 2008
Posts: 4
Thanks a lot Joe !!

I will try code for sftp now.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem in connecting to FTP server