public interface SshTransport extends SshIO
Simple interface wrapper for transport layer communication. An SSH connection requires a transport layer for communication and this interface defines the general contract. Typically SSH will execute over a TCPIP Socket however the use of this interface allows any type of transport that can expose a set of I/O streams. In the simplest form this interface will be implemented for a Socket as follows:
import java.net.Socket; import java.io.*; public class SocketTransport extends Socket implements SshTransport { public SocketProvider(String host, int port) throws IOException { super(host, port); } public String getConnectedHost() { return getInetAddress().getHostName(); } ** The close, getInputStream and getOutputStream methods are exposed ** ** directly by the Socket. **
Modifier and Type | Method and Description |
---|---|
SshTransport |
duplicate()
Create a new copy of this transport and connect to the
same host:port combination.
|
String |
getHost()
Get the name of the connected host.
|
int |
getPort()
Get the port of this connection
|
close, getInputStream, getOutputStream
String getHost()
int getPort()
SshTransport duplicate() throws IOException
SshException
IOException
Copyright © 2024. All rights reserved.