Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

SFTP PROBLEM!!!

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String host = host_adress
SshClient ssh = new SshClient();
ssh.connect(host,port);
System.out.println("ssh is connected--->"+ssh.isConnected());
PasswordAuthenticationClient passwordAuthenticationClient = new PasswordAuthenticationClient();
passwordAuthenticationClient.setPassword(password);
passwordAuthenticationClient.setUsername(username);
int result = ssh.authenticate(passwordAuthenticationClient);
if(result != AuthenticationProtocolState.COMPLETE){
throw new Exception("Login to host failed");
}
ssh.disconnect();

Above i just want to connect to an FTP server. We gave them our IP adress and they gave us which port to connect and also we gave them the information that we would connect to their FTP server by using Core FTP.
They opened their port.

When i try to connect; i get this exception


java.net.ConnectException: Connection refused: connect

I use com.sshtools.j2ssh

What is wrong here? FTP over SSH? Yes i am using this. I also want to add that on the browser i get certificate error.

I'm gonna loose my mind...
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you connect using FileZilla or CuteFTP to that ftp server?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic