javaremote-server

com.jcraft.jsch.JSchException: connection is closed by foreign host


After running my java program, I become the error above. What did I wrong?

enter image description here

After running my java program, I want be able to connect to the given windows remote server and send a data file there.


Solution

  • Added my comment as an answer.

    Looking at your code your trying to connect to an http port (80), you should most likely be using port 22 (default ssh port) assuming the FTP Server is listening on port 22. Some sites change this for security reasons.

    You would have to reach out to the admin if you don't have the sftp server details.