com.maverick.ssh
Interface SshTransport

All Superinterfaces:
SshIO
All Known Subinterfaces:
SshTunnel
All Known Implementing Classes:
HttpProxyTransport, HttpProxyTransportWrapper, SocketTransport, SocketWrapper, SocksProxyTransport

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.                                           **
 

Author:
Lee David Painter

Method Summary
 SshTransport duplicate()
          Create a new copy of this transport and connect to the same host:port combination.
 java.lang.String getHost()
          Get the name of the connected host.
 int getPort()
          Get the port of this connection
 
Methods inherited from interface com.maverick.ssh.SshIO
close, getInputStream, getOutputStream
 

Method Detail

getHost

public java.lang.String getHost()
Get the name of the connected host.

Returns:
the name of the connected host

getPort

public int getPort()
Get the port of this connection

Returns:
int

duplicate

public SshTransport duplicate()
                       throws java.io.IOException
Create a new copy of this transport and connect to the same host:port combination. This is used by the SshClient to duplicate a client connection.

Returns:
Throws:
SshException
java.io.IOException


Copyright © 2003 3SP LTD. All Rights Reserved.