|
SSH Factory | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jscape.inet.ipclient.IpClient
com.jscape.inet.ipclientssh.IpClientSsh
Implements basic functionality of a TCP/IP client connection tunnelling data through a secure SSH connection.
Example usage:
// connection information for SSH server
String sshHostname = "10.0.0.1";
String sshUsername = "jsmith";
String sshPassword = "secret";
try {
// create new SshParameters instance
SshParameters sshParams = new SshParameters(sshHostname,sshUsername,sshPassword);
// create new IpClient instance with SSH parameters, hostname, port and
timeout arguments
IpClientSsh client = new IpClientSsh(sshParams,"10.0.0.1",53,5000);
// establish connection with server
client.connect();
// obtain OutputStream for sending data to server
OutputStream out = client.getOutputStream();
// obtain InputStream for reading data from server
InputStream in = client.getInputStream();
// disconnect from server
client.disconnect();
} catch(IpClientException ipe) {
ipe.printStackTrace();
}
| Constructor Summary | |
IpClientSsh(SshParameters sshParameters,
java.lang.String hostname,
int port)
Creates a new IpClientSsh instance. |
|
IpClientSsh(SshParameters sshParameters,
java.lang.String hostname,
int port,
int timeout)
Creates a new IpClientSsh instance. |
|
IpClientSsh(SshParameters sshParameters,
java.lang.String hostname,
int port,
int timeout,
com.jscape.inet.ssh.SshConfiguration config)
|
|
| Method Summary | |
void |
connect()
Establishes connection with SSH server, performs authentication and creates tunnel to hostname and port provided in constructor. |
void |
disconnect()
Closes tunnel between SSH server and host and closes connection to SSH server. |
java.net.Socket |
getSocket()
Gets Socket established after invoking the IpClient#connect method. |
| Methods inherited from class com.jscape.inet.ipclient.IpClient |
addIpClientListener, getInputStream, getOutputStream, removeIpClientListener, setInputStream, setOutputStream, setSocket |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public IpClientSsh(SshParameters sshParameters,
java.lang.String hostname,
int port)
hostname - the hostname of server to connect toport - the port of server to connect tosshParameters - the SSH parameters used in establishing secure
connection
public IpClientSsh(SshParameters sshParameters,
java.lang.String hostname,
int port,
int timeout)
hostname - the hostname of server to connect toport - the port of server to connect totimeout - the timeout period to wait before connection to
server is establishedsshParameters - the SSH parameters used in establishing secure
connection
public IpClientSsh(SshParameters sshParameters,
java.lang.String hostname,
int port,
int timeout,
com.jscape.inet.ssh.SshConfiguration config)
sshParameters - hostname - port - timeout - config - | Method Detail |
public void connect()
throws IpClientException
connect in class IpClientIpClientException - if an error occurs while establishing
connection
public void disconnect()
throws IpClientException
disconnect in class IpClientIpClientException - if an I/O related error occurspublic java.net.Socket getSocket()
getSocket in class IpClientconnect()
|
SSH Factory | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||