Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.1k views
in Java FTP by (120 points)
Hi,
I am working to connect to a FTP server located in the client site and pull some data.
Manually I do that by connecting to it using HTTPS://URL and then login to that server.
Also it uses a proxy server to connect to taht from my machine.

Now I wanted to that thru a java program and Witten a sample code.
But it does not seem to be working. Can anyone help me in resolving this.

The below is the code which I am using..
SSHFTPClient ftp = new SSHFTPClient();
ftp.setRemoteHost("<<proxy URL>>");
ftp.setRemotePort("<<proxy port>>");
ftp.setAuthentication("ftp_user@ftpservername", "ftp_password");
ftp.connect();

But it displays with the following error. Is there anything i can do to get more debugging info

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.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.enterprisedt.net.j2ssh.net.SocketTransportProvider.<init>(Unknown Source)
at com.enterprisedt.net.j2ssh.net.SocketTransportProvider.createSocketTransportProvider(Unknown Source)
at com.enterprisedt.net.j2ssh.net.TransportProviderFactory.connectTransportProvider(Unknown Source)
at com.enterprisedt.net.j2ssh.SshClient.connect(Unknown Source)
at com.enterprisedt.net.ftp.ssh.SSHFTPClient.connect(Unknown Source)
at test.SFTPFile.sendFile(SFTPFile.java:47)
at test.SFTPFile.main(SFTPFile.java:69)

Regards,
Dhanu.

1 Answer

0 votes
by (162k points)
If you are using https, you are connecting to a web server, not an FTP server.

You need to verify you have an SFTP server at ftpservername.

Categories

...