com.mindbright.ssh2
public final class SSH2Listener extends java.lang.Object implements java.lang.Runnable
SSH2Listener
instance for each local forward.SSH2Connection
Constructor and Description |
---|
SSH2Listener(java.lang.String localAddr,
int localPort,
SSH2Connection connection)
Creates the remote listener for remote connections.
|
SSH2Listener(java.lang.String localAddr,
int localPort,
java.lang.String remoteAddr,
int remotePort,
SSH2Connection connection,
SSH2StreamFilterFactory filterFactory)
Creates a listener for filtered connections.
|
SSH2Listener(java.lang.String localAddr,
int localPort,
java.lang.String remoteAddr,
int remotePort,
SSH2Connection connection,
SSH2StreamFilterFactory filterFactory,
int acceptTimeout)
Creates a listener for filtered connections.
|
Modifier and Type | Method and Description |
---|---|
void |
doConnect(java.net.Socket fwdSocket)
Handle a connect from the given socket.
|
SSH2Connection |
getConnection() |
java.lang.String |
getListenHost() |
int |
getListenPort() |
java.lang.String |
getRemoteHost() |
int |
getRemotePort() |
void |
run()
Run the listener and listen for connections.
|
void |
sendChannelOpen(SSH2TCPChannel channel,
java.net.Socket fwdSocket)
Send a channel open for the given socket.
|
void |
setAcceptMax(int acceptMax) |
void |
setRetries(int numOfRetries) |
void |
setRetryDelay(long retryDelayTime) |
void |
setThreadPriority(int prio) |
void |
stop()
Stop the listener.
|
public SSH2Listener(java.lang.String localAddr, int localPort, java.lang.String remoteAddr, int remotePort, SSH2Connection connection, SSH2StreamFilterFactory filterFactory, int acceptTimeout) throws java.io.IOException
localAddr
- The address to open the listener to. should
normally be "127.0.0.1".localPort
- The local port to listen at.remoteAddr
- The remote address to connect to. Note that
this name is resolved on the server.remotePort
- The remote port to connect to.connection
- The connection to use.filterFactory
- Factory which creates filter
instances. There will be one filter created per connection.acceptTimeout
- Timeout for accept call.java.io.IOException
public SSH2Listener(java.lang.String localAddr, int localPort, java.lang.String remoteAddr, int remotePort, SSH2Connection connection, SSH2StreamFilterFactory filterFactory) throws java.io.IOException
localAddr
- The address to open the listener to. should
normally be "127.0.0.1".localPort
- The local port to listen at.remoteAddr
- The remote address to connect to. Note that
this name is resolved on the server.remotePort
- The remote port to connect to.connection
- The connection to use.filterFactory
- Factory which creates filter
instances. There will be one filter created per connection.java.io.IOException
public SSH2Listener(java.lang.String localAddr, int localPort, SSH2Connection connection) throws java.io.IOException
localAddr
- The address to open the listener to. should
normally be "127.0.0.1".localPort
- The local port to listen at.connection
- The connection to use.java.io.IOException
public void run()
run
in interface java.lang.Runnable
public void doConnect(java.net.Socket fwdSocket)
fwdSocket
- A connected socket.public void sendChannelOpen(SSH2TCPChannel channel, java.net.Socket fwdSocket)
doConnect
once first
before calling this function.channel
- The channel to retry to open on.fwdSocket
- Socket identifying the local end.public SSH2Connection getConnection()
public void setAcceptMax(int acceptMax)
public void setRetries(int numOfRetries)
public void setRetryDelay(long retryDelayTime)
public void setThreadPriority(int prio)
public int getListenPort()
public java.lang.String getListenHost()
public int getRemotePort()
public java.lang.String getRemoteHost()
public void stop()