我正在使用SSHJ库建立反向ssh隧道,但没有运气..
Error: Unable to resolve host name
使用的代码:
final SSHClient ssh = new SSHClient(new AndroidConfig());
Command cmd = null;
// Adds a nullHostKeyVerifier
ssh.addHostKeyVerifier(new NullHostKeyVerifier());
// default port number
int pn = 22;
// connect to the machine
try {
String pemkey = "/mnt/sdcard/lamp.pem";
ssh.loadKeys(pemkey);
ssh.connect("-R 8080:localhost:8080 root@54.X.X.X ",pn);
// Authenticate with the password entered
// start a new session
final Session session = ssh.startSession();
} catch (IOException e) {
Log.e("message", e.getMessage(), e);
}
答案 0 :(得分:1)