| 构造器和说明 |
|---|
GanymedSession(ch.ethz.ssh2.Connection connection)
构造
|
GanymedSession(Connector connector)
构造
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
bindLocalPort(String remoteHost,
int remotePort,
int localPort)
绑定端口到本地。
|
boolean |
bindLocalPort(String remoteHost,
int remotePort,
String localHost,
int localPort)
绑定端口到本地。
|
boolean |
bindRemotePort(int bindPort,
String host,
int port)
绑定ssh服务端的serverPort端口, 到host主机的port端口上.
|
void |
close() |
String |
exec(String cmd,
Charset charset,
OutputStream errStream)
执行Shell命令(使用EXEC方式)
此方法单次发送一个命令到服务端,不读取环境变量,不会产生阻塞。
|
String |
execByShell(String cmd,
Charset charset,
OutputStream errStream)
执行Shell命令
此方法单次发送一个命令到服务端,自动读取环境变量,可能产生阻塞。
|
ch.ethz.ssh2.Session |
getRaw() |
boolean |
isConnected()
是否连接状态
|
void |
unBindLocalPort(int localPort)
解除本地端口映射
|
void |
unBindRemotePort(int localPort)
解除远程端口映射
|
public GanymedSession(ch.ethz.ssh2.Connection connection)
connection - Connection,连接对象public boolean isConnected()
SessionisConnected 在接口中 Sessionpublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionpublic boolean bindLocalPort(String remoteHost, int remotePort, int localPort) throws IORuntimeException
remoteHost - 远程主机remotePort - 远程端口localPort - 本地端口IORuntimeException - 端口绑定失败异常public boolean bindLocalPort(String remoteHost, int remotePort, String localHost, int localPort) throws IORuntimeException
remoteHost - 远程主机remotePort - 远程端口localHost - 本地主机localPort - 本地端口IORuntimeException - 端口绑定失败异常public void unBindLocalPort(int localPort)
throws IORuntimeException
localPort - 需要解除的本地端口IORuntimeException - 端口解绑失败异常public boolean bindRemotePort(int bindPort,
String host,
int port)
throws IORuntimeException
bindPort - ssh服务端上要被绑定的端口host - 转发到的hostport - host上的端口IORuntimeException - 端口绑定失败异常public void unBindRemotePort(int localPort)
throws IORuntimeException
localPort - 需要解除的本地端口IORuntimeException - 端口解绑失败异常public String exec(String cmd, Charset charset, OutputStream errStream)
此方法单次发送一个命令到服务端,不读取环境变量,不会产生阻塞。
cmd - 命令charset - 发送和读取内容的编码errStream - 错误信息输出到的位置public String execByShell(String cmd, Charset charset, OutputStream errStream)
此方法单次发送一个命令到服务端,自动读取环境变量,可能产生阻塞。
cmd - 命令charset - 发送和读取内容的编码errStream - 错误信息输出到的位置Copyright © 2023. All rights reserved.