Secure iNet Factory

com.jscape.inet.ssh.connection
Class RemotePort

java.lang.Object
  extended by com.jscape.inet.ssh.connection.RemotePort

public class RemotePort
extends java.lang.Object

Author:
Alex Usun

Field Summary
static java.lang.String ANY_HOST
          This value means that the server accepts connection from any host
static int ANY_PORT
          This value means that the server binds the first free port
static java.lang.String CLOSE_REQUEST
          Global request name for closing remote port forwarding
static java.lang.String OPEN_REQUEST
          Global request name for opening remote port forwarding
 
Constructor Summary
RemotePort(java.net.InetAddress address, int port, Connection connection)
          Creates a new remote port forwarding service.
 
Method Summary
 Channel accept()
          Accepts the incoming remote connection.
 void close()
          Closes the remote port forwarding service.
 java.net.InetAddress getAddress()
          Obtains the host address from which this service accepts the connections.
 int getPort()
          Obtains the port value which this service is bound to.
 Message handle(com.jscape.inet.ssh.connection.messages.SshMsgChannelOpen request)
           
 boolean isClosed()
          Checks if the remote port forwarding service is closed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPEN_REQUEST

public static final java.lang.String OPEN_REQUEST
Global request name for opening remote port forwarding

See Also:
Constant Field Values

CLOSE_REQUEST

public static final java.lang.String CLOSE_REQUEST
Global request name for closing remote port forwarding

See Also:
Constant Field Values

ANY_HOST

public static final java.lang.String ANY_HOST
This value means that the server accepts connection from any host

See Also:
Constant Field Values

ANY_PORT

public static final int ANY_PORT
This value means that the server binds the first free port

See Also:
Constant Field Values
Constructor Detail

RemotePort

public RemotePort(java.net.InetAddress address,
                  int port,
                  Connection connection)
           throws java.io.IOException,
                  ConnectionException
Creates a new remote port forwarding service.

Parameters:
address - the host address from which this service accepts the connections, "0.0.0.0" for any host
port - the port to listen
connection - the underlayed connection service
Throws:
java.io.IOException
ConnectionException
Method Detail

getAddress

public java.net.InetAddress getAddress()
Obtains the host address from which this service accepts the connections.

Returns:
the host address value

getPort

public int getPort()
Obtains the port value which this service is bound to.

Returns:
the port value

accept

public Channel accept()
               throws java.io.IOException
Accepts the incoming remote connection. This method will block until the new connection arrives or the service is closed.

Returns:
the connection channel instance
Throws:
java.io.IOException - if an I/O error occurs or the service is closed

handle

public Message handle(com.jscape.inet.ssh.connection.messages.SshMsgChannelOpen request)
Parameters:
request -

close

public void close()
Closes the remote port forwarding service.


isClosed

public boolean isClosed()
Checks if the remote port forwarding service is closed.

Returns:
true if the remote port forwarding is closed; false otherwise

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved