com.jcraft.jsch
Class Session

java.lang.Object
  extended by com.jcraft.jsch.Session
All Implemented Interfaces:
java.lang.Runnable

public class Session
extends java.lang.Object
implements java.lang.Runnable


Field Summary
protected  boolean daemon_thread
           
 
Method Summary
 void connect()
           
 void connect(int connectTimeout)
           
 void delPortForwardingL(int lport)
           
 void delPortForwardingL(java.lang.String boundaddress, int lport)
           
 void delPortForwardingR(int rport)
           
 void disconnect()
           
 void encode(Packet packet)
           
 java.lang.String getClientVersion()
           
 java.lang.String getConfig(java.lang.String key)
           
 java.lang.String getHost()
           
 HostKey getHostKey()
           
 java.lang.String getHostKeyAlias()
           
 int getPort()
           
 java.lang.String[] getPortForwardingL()
           
 int getServerAliveCountMax()
          Returns setting for the threshold to send keep-alive messages.
 int getServerAliveInterval()
          Returns setting for the interval to send a keep-alive message.
 java.lang.String getServerVersion()
           
 int getTimeout()
           
 UserInfo getUserInfo()
           
 java.lang.String getUserName()
           
 boolean isConnected()
           
 Channel openChannel(java.lang.String type)
           
 Buffer read(Buffer buf)
           
 void rekey()
           
 void run()
           
 void sendIgnore()
           
 void sendKeepAliveMsg()
           
 void setClientVersion(java.lang.String cv)
           
 void setConfig(java.util.Hashtable newconf)
           
 void setConfig(java.util.Properties newconf)
           
 void setConfig(java.lang.String key, java.lang.String value)
           
 void setDaemonThread(boolean enable)
           
 void setHost(java.lang.String host)
           
 void setHostKeyAlias(java.lang.String hostKeyAlias)
           
 void setIdentityRepository(IdentityRepository identityRepository)
          Sets the identityRepository, which will be referred in the public key authentication.
 void setInputStream(java.io.InputStream in)
           
 void setOutputStream(java.io.OutputStream out)
           
 void setPassword(byte[] password)
           
 void setPassword(java.lang.String password)
           
 void setPort(int port)
           
 int setPortForwardingL(int lport, java.lang.String host, int rport)
           
 int setPortForwardingL(java.lang.String boundaddress, int lport, java.lang.String host, int rport)
           
 int setPortForwardingL(java.lang.String boundaddress, int lport, java.lang.String host, int rport, ServerSocketFactory ssf)
           
 void setPortForwardingR(int rport, java.lang.String daemon)
           
 void setPortForwardingR(int rport, java.lang.String host, int lport)
           
 void setPortForwardingR(int rport, java.lang.String host, int lport, SocketFactory sf)
           
 void setPortForwardingR(int rport, java.lang.String daemon, java.lang.Object[] arg)
           
 void setPortForwardingR(java.lang.String bind_address, int rport, java.lang.String host, int lport)
           
 void setPortForwardingR(java.lang.String bind_address, int rport, java.lang.String host, int lport, SocketFactory sf)
           
 void setPortForwardingR(java.lang.String bind_address, int rport, java.lang.String daemon, java.lang.Object[] arg)
           
 void setProxy(Proxy proxy)
           
 void setServerAliveCountMax(int count)
          Sets the number of keep-alive messages which may be sent without receiving any messages back from the server.
 void setServerAliveInterval(int interval)
          Sets the interval to send a keep-alive message.
 void setSocketFactory(SocketFactory sfactory)
           
 void setTimeout(int timeout)
           
 void setUserInfo(UserInfo userinfo)
           
 void setX11Cookie(java.lang.String cookie)
           
 void setX11Host(java.lang.String host)
           
 void setX11Port(int port)
           
 void write(Packet packet)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

daemon_thread

protected boolean daemon_thread
Method Detail

connect

public void connect()
             throws JSchException
Throws:
JSchException

connect

public void connect(int connectTimeout)
             throws JSchException
Throws:
JSchException

rekey

public void rekey()
           throws java.lang.Exception
Throws:
java.lang.Exception

openChannel

public Channel openChannel(java.lang.String type)
                    throws JSchException
Throws:
JSchException

encode

public void encode(Packet packet)
            throws java.lang.Exception
Throws:
java.lang.Exception

read

public Buffer read(Buffer buf)
            throws java.lang.Exception
Throws:
java.lang.Exception

write

public void write(Packet packet)
           throws java.lang.Exception
Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable

disconnect

public void disconnect()

setPortForwardingL

public int setPortForwardingL(int lport,
                              java.lang.String host,
                              int rport)
                       throws JSchException
Throws:
JSchException

setPortForwardingL

public int setPortForwardingL(java.lang.String boundaddress,
                              int lport,
                              java.lang.String host,
                              int rport)
                       throws JSchException
Throws:
JSchException

setPortForwardingL

public int setPortForwardingL(java.lang.String boundaddress,
                              int lport,
                              java.lang.String host,
                              int rport,
                              ServerSocketFactory ssf)
                       throws JSchException
Throws:
JSchException

delPortForwardingL

public void delPortForwardingL(int lport)
                        throws JSchException
Throws:
JSchException

delPortForwardingL

public void delPortForwardingL(java.lang.String boundaddress,
                               int lport)
                        throws JSchException
Throws:
JSchException

getPortForwardingL

public java.lang.String[] getPortForwardingL()
                                      throws JSchException
Throws:
JSchException

setPortForwardingR

public void setPortForwardingR(int rport,
                               java.lang.String host,
                               int lport)
                        throws JSchException
Throws:
JSchException

setPortForwardingR

public void setPortForwardingR(java.lang.String bind_address,
                               int rport,
                               java.lang.String host,
                               int lport)
                        throws JSchException
Throws:
JSchException

setPortForwardingR

public void setPortForwardingR(int rport,
                               java.lang.String host,
                               int lport,
                               SocketFactory sf)
                        throws JSchException
Throws:
JSchException

setPortForwardingR

public void setPortForwardingR(java.lang.String bind_address,
                               int rport,
                               java.lang.String host,
                               int lport,
                               SocketFactory sf)
                        throws JSchException
Throws:
JSchException

setPortForwardingR

public void setPortForwardingR(int rport,
                               java.lang.String daemon)
                        throws JSchException
Throws:
JSchException

setPortForwardingR

public void setPortForwardingR(int rport,
                               java.lang.String daemon,
                               java.lang.Object[] arg)
                        throws JSchException
Throws:
JSchException

setPortForwardingR

public void setPortForwardingR(java.lang.String bind_address,
                               int rport,
                               java.lang.String daemon,
                               java.lang.Object[] arg)
                        throws JSchException
Throws:
JSchException

delPortForwardingR

public void delPortForwardingR(int rport)
                        throws JSchException
Throws:
JSchException

setProxy

public void setProxy(Proxy proxy)

setHost

public void setHost(java.lang.String host)

setPort

public void setPort(int port)

setUserInfo

public void setUserInfo(UserInfo userinfo)

getUserInfo

public UserInfo getUserInfo()

setInputStream

public void setInputStream(java.io.InputStream in)

setOutputStream

public void setOutputStream(java.io.OutputStream out)

setX11Host

public void setX11Host(java.lang.String host)

setX11Port

public void setX11Port(int port)

setX11Cookie

public void setX11Cookie(java.lang.String cookie)

setPassword

public void setPassword(java.lang.String password)

setPassword

public void setPassword(byte[] password)

setConfig

public void setConfig(java.util.Properties newconf)

setConfig

public void setConfig(java.util.Hashtable newconf)

setConfig

public void setConfig(java.lang.String key,
                      java.lang.String value)

getConfig

public java.lang.String getConfig(java.lang.String key)

setSocketFactory

public void setSocketFactory(SocketFactory sfactory)

isConnected

public boolean isConnected()

getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int timeout)
                throws JSchException
Throws:
JSchException

getServerVersion

public java.lang.String getServerVersion()

getClientVersion

public java.lang.String getClientVersion()

setClientVersion

public void setClientVersion(java.lang.String cv)

sendIgnore

public void sendIgnore()
                throws java.lang.Exception
Throws:
java.lang.Exception

sendKeepAliveMsg

public void sendKeepAliveMsg()
                      throws java.lang.Exception
Throws:
java.lang.Exception

getHostKey

public HostKey getHostKey()

getHost

public java.lang.String getHost()

getUserName

public java.lang.String getUserName()

getPort

public int getPort()

setHostKeyAlias

public void setHostKeyAlias(java.lang.String hostKeyAlias)

getHostKeyAlias

public java.lang.String getHostKeyAlias()

setServerAliveInterval

public void setServerAliveInterval(int interval)
                            throws JSchException
Sets the interval to send a keep-alive message. If zero is specified, any keep-alive message must not be sent. The default interval is zero.

Parameters:
interval - the specified interval, in milliseconds.
Throws:
JSchException
See Also:
getServerAliveInterval()

getServerAliveInterval

public int getServerAliveInterval()
Returns setting for the interval to send a keep-alive message.

See Also:
setServerAliveInterval(int)

setServerAliveCountMax

public void setServerAliveCountMax(int count)
Sets the number of keep-alive messages which may be sent without receiving any messages back from the server. If this threshold is reached while keep-alive messages are being sent, the connection will be disconnected. The default value is one.

Parameters:
count - the specified count
See Also:
getServerAliveCountMax()

getServerAliveCountMax

public int getServerAliveCountMax()
Returns setting for the threshold to send keep-alive messages.

See Also:
#getServerAliveCountMax(int)

setDaemonThread

public void setDaemonThread(boolean enable)

setIdentityRepository

public void setIdentityRepository(IdentityRepository identityRepository)
Sets the identityRepository, which will be referred in the public key authentication. The default value is null.

Parameters:
identityRepository -
See Also:
getIdentityRepository()


Copyright © 2012 JCraft,Inc.. All Rights Reserved.