Xessa 0 Junior Poster in Training
String host = host_adress 
SshClient ssh = new SshClient(); 
ssh.connect(host,10022); 
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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.