| 构造器和说明 |
|---|
GanymedSession(ch.ethz.ssh2.Connection connection)
构造
|
GanymedSession(Connector connector)
构造
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
bindLocalPort(InetSocketAddress localAddress,
InetSocketAddress remoteAddress)
绑定端口到本地。
|
void |
bindRemotePort(InetSocketAddress remoteAddress,
InetSocketAddress localAddress)
绑定ssh服务端的serverPort端口, 到本地主机的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(InetSocketAddress localAddress)
解除本地端口映射
|
void |
unBindRemotePort(InetSocketAddress remoteAddress)
解除远程端口映射
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbindLocalPort, unBindLocalPortpublic GanymedSession(ch.ethz.ssh2.Connection connection)
connection - Connection,连接对象public boolean isConnected()
SessionisConnected 在接口中 Sessionpublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionpublic void bindLocalPort(InetSocketAddress localAddress, InetSocketAddress remoteAddress) throws IORuntimeException
SessionbindLocalPort 在接口中 SessionlocalAddress - 本地主机和端口remoteAddress - 远程主机和端口IORuntimeExceptionpublic void unBindLocalPort(InetSocketAddress localAddress) throws IORuntimeException
SessionunBindLocalPort 在接口中 SessionlocalAddress - 需要解除的本地地址IORuntimeExceptionpublic void bindRemotePort(InetSocketAddress remoteAddress, InetSocketAddress localAddress) throws IORuntimeException
SessionbindRemotePort 在接口中 SessionremoteAddress - ssh服务端上要被绑定的地址localAddress - 转发到的本地地址IORuntimeExceptionpublic void unBindRemotePort(InetSocketAddress remoteAddress) throws IORuntimeException
SessionunBindRemotePort 在接口中 SessionremoteAddress - 需要解除的远程地址和端口IORuntimeExceptionpublic String exec(String cmd, Charset charset, OutputStream errStream)
此方法单次发送一个命令到服务端,不读取环境变量,不会产生阻塞。
cmd - 命令charset - 发送和读取内容的编码errStream - 错误信息输出到的位置public String execByShell(String cmd, Charset charset, OutputStream errStream)
此方法单次发送一个命令到服务端,自动读取环境变量,可能产生阻塞。
cmd - 命令charset - 发送和读取内容的编码errStream - 错误信息输出到的位置Copyright © 2024. All rights reserved.