blob: 4bb18c49788a9e681eac7c21defb2ca3382266a8 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_12) on Tue Apr 01 14:48:49 CEST 2008 -->
<TITLE>
Session
</TITLE>
<META NAME="keywords" CONTENT="com.trilead.ssh2.Session class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Session";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../com/trilead/ssh2/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Session.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
Trilead SSH-2 for Java</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/trilead/ssh2/ServerHostKeyVerifier.html" title="interface in com.trilead.ssh2"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/trilead/ssh2/SFTPException.html" title="class in com.trilead.ssh2"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?com/trilead/ssh2/Session.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Session.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.trilead.ssh2</FONT>
<BR>
Class Session</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.trilead.ssh2.Session</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Session</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
A <code>Session</code> is a remote execution of a program. "Program" means
in this context either a shell, an application or a system command. The
program may or may not have a tty. Only one single program can be started on
a session. However, multiple sessions can be active simultaneously.
<P>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>$Id: Session.java,v 1.2 2008/03/03 07:01:36 cplattne Exp $</DD>
<DT><B>Author:</B></DT>
<DD>Christian Plattner, plattner@trilead.com</DD>
</DL>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#close()">close</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Close this session.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#execCommand(java.lang.String)">execCommand</A></B>(java.lang.String&nbsp;cmd)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Execute a command on the remote machine.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#getExitSignal()">getExitSignal</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the name of the signal by which the process on the remote side was
stopped - if available and applicable.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.Integer</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#getExitStatus()">getExitStatus</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the exit code/status from the remote command - if available.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.io.InputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#getStderr()">getStderr</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.io.OutputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#getStdin()">getStdin</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.io.InputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#getStdout()">getStdout</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#ping()">ping</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method can be used to perform end-to-end session (i.e., SSH channel)
testing.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#requestDumbPTY()">requestDumbPTY</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basically just a wrapper for lazy people - identical to calling
<code>requestPTY("dumb", 0, 0, 0, 0, null)</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#requestPTY(java.lang.String)">requestPTY</A></B>(java.lang.String&nbsp;term)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basically just another wrapper for lazy people - identical to calling
<code>requestPTY(term, 0, 0, 0, 0, null)</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#requestPTY(java.lang.String, int, int, int, int, byte[])">requestPTY</A></B>(java.lang.String&nbsp;term,
int&nbsp;term_width_characters,
int&nbsp;term_height_characters,
int&nbsp;term_width_pixels,
int&nbsp;term_height_pixels,
byte[]&nbsp;terminal_modes)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allocate a pseudo-terminal for this session.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#requestX11Forwarding(java.lang.String, int, byte[], boolean)">requestX11Forwarding</A></B>(java.lang.String&nbsp;hostname,
int&nbsp;port,
byte[]&nbsp;cookie,
boolean&nbsp;singleConnection)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Request X11 forwarding for the current session.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#startShell()">startShell</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Start a shell on the remote machine.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#startSubSystem(java.lang.String)">startSubSystem</A></B>(java.lang.String&nbsp;name)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Start a subsystem on the remote machine.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#waitForCondition(int, long)">waitForCondition</A></B>(int&nbsp;condition_set,
long&nbsp;timeout)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method blocks until certain conditions hold true on the underlying SSH-2 channel.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/trilead/ssh2/Session.html#waitUntilDataAvailable(long)">waitUntilDataAvailable</A></B>(long&nbsp;timeout)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>This method has been replaced with a much more powerful wait-for-condition
interface and therefore acts only as a wrapper.</I></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="requestDumbPTY()"><!-- --></A><H3>
requestDumbPTY</H3>
<PRE>
public void <B>requestDumbPTY</B>()
throws java.io.IOException</PRE>
<DL>
<DD>Basically just a wrapper for lazy people - identical to calling
<code>requestPTY("dumb", 0, 0, 0, 0, null)</code>.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="requestPTY(java.lang.String)"><!-- --></A><H3>
requestPTY</H3>
<PRE>
public void <B>requestPTY</B>(java.lang.String&nbsp;term)
throws java.io.IOException</PRE>
<DL>
<DD>Basically just another wrapper for lazy people - identical to calling
<code>requestPTY(term, 0, 0, 0, 0, null)</code>.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="requestPTY(java.lang.String, int, int, int, int, byte[])"><!-- --></A><H3>
requestPTY</H3>
<PRE>
public void <B>requestPTY</B>(java.lang.String&nbsp;term,
int&nbsp;term_width_characters,
int&nbsp;term_height_characters,
int&nbsp;term_width_pixels,
int&nbsp;term_height_pixels,
byte[]&nbsp;terminal_modes)
throws java.io.IOException</PRE>
<DL>
<DD>Allocate a pseudo-terminal for this session.
<p>
This method may only be called before a program or shell is started in
this session.
<p>
Different aspects can be specified:
<p>
<ul>
<li>The TERM environment variable value (e.g., vt100)</li>
<li>The terminal's dimensions.</li>
<li>The encoded terminal modes.</li>
</ul>
Zero dimension parameters are ignored. The character/row dimensions
override the pixel dimensions (when nonzero). Pixel dimensions refer to
the drawable area of the window. The dimension parameters are only
informational. The encoding of terminal modes (parameter
<code>terminal_modes</code>) is described in RFC4254.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>term</CODE> - The TERM environment variable value (e.g., vt100)<DD><CODE>term_width_characters</CODE> - terminal width, characters (e.g., 80)<DD><CODE>term_height_characters</CODE> - terminal height, rows (e.g., 24)<DD><CODE>term_width_pixels</CODE> - terminal width, pixels (e.g., 640)<DD><CODE>term_height_pixels</CODE> - terminal height, pixels (e.g., 480)<DD><CODE>terminal_modes</CODE> - encoded terminal modes (may be <code>null</code>)
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="requestX11Forwarding(java.lang.String, int, byte[], boolean)"><!-- --></A><H3>
requestX11Forwarding</H3>
<PRE>
public void <B>requestX11Forwarding</B>(java.lang.String&nbsp;hostname,
int&nbsp;port,
byte[]&nbsp;cookie,
boolean&nbsp;singleConnection)
throws java.io.IOException</PRE>
<DL>
<DD>Request X11 forwarding for the current session.
<p>
You have to supply the name and port of your X-server.
<p>
This method may only be called before a program or shell is started in
this session.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>hostname</CODE> - the hostname of the real (target) X11 server (e.g., 127.0.0.1)<DD><CODE>port</CODE> - the port of the real (target) X11 server (e.g., 6010)<DD><CODE>cookie</CODE> - if non-null, then present this cookie to the real X11 server<DD><CODE>singleConnection</CODE> - if true, then the server is instructed to only forward one single
connection, no more connections shall be forwarded after first, or after the session
channel has been closed
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="execCommand(java.lang.String)"><!-- --></A><H3>
execCommand</H3>
<PRE>
public void <B>execCommand</B>(java.lang.String&nbsp;cmd)
throws java.io.IOException</PRE>
<DL>
<DD>Execute a command on the remote machine.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>cmd</CODE> - The command to execute on the remote host.
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="startShell()"><!-- --></A><H3>
startShell</H3>
<PRE>
public void <B>startShell</B>()
throws java.io.IOException</PRE>
<DL>
<DD>Start a shell on the remote machine.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="startSubSystem(java.lang.String)"><!-- --></A><H3>
startSubSystem</H3>
<PRE>
public void <B>startSubSystem</B>(java.lang.String&nbsp;name)
throws java.io.IOException</PRE>
<DL>
<DD>Start a subsystem on the remote machine.
Unless you know what you are doing, you will never need this.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the subsystem.
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="ping()"><!-- --></A><H3>
ping</H3>
<PRE>
public void <B>ping</B>()
throws java.io.IOException</PRE>
<DL>
<DD>This method can be used to perform end-to-end session (i.e., SSH channel)
testing. It sends a 'ping' message to the server and waits for the 'pong'
from the server.
<p>
Implementation details: this method sends a SSH_MSG_CHANNEL_REQUEST request
('trilead-ping') to the server and waits for the SSH_MSG_CHANNEL_FAILURE reply
packet.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - in case of any problem or when the session is closed</DL>
</DD>
</DL>
<HR>
<A NAME="getStdout()"><!-- --></A><H3>
getStdout</H3>
<PRE>
public java.io.InputStream <B>getStdout</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getStderr()"><!-- --></A><H3>
getStderr</H3>
<PRE>
public java.io.InputStream <B>getStderr</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getStdin()"><!-- --></A><H3>
getStdin</H3>
<PRE>
public java.io.OutputStream <B>getStdin</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="waitUntilDataAvailable(long)"><!-- --></A><H3>
waitUntilDataAvailable</H3>
<PRE>
public int <B>waitUntilDataAvailable</B>(long&nbsp;timeout)
throws java.io.IOException</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>This method has been replaced with a much more powerful wait-for-condition
interface and therefore acts only as a wrapper.</I>
<P>
<DD>This method blocks until there is more data available on either the
stdout or stderr InputStream of this <code>Session</code>. Very useful
if you do not want to use two parallel threads for reading from the two
InputStreams. One can also specify a timeout. NOTE: do NOT call this
method if you use concurrent threads that operate on either of the two
InputStreams of this <code>Session</code> (otherwise this method may
block, even though more data is available).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>timeout</CODE> - The (non-negative) timeout in <code>ms</code>. <code>0</code> means no
timeout, the call may block forever.
<DT><B>Returns:</B><DD><ul>
<li><code>0</code> if no more data will arrive.</li>
<li><code>1</code> if more data is available.</li>
<li><code>-1</code> if a timeout occurred.</li>
</ul>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="waitForCondition(int, long)"><!-- --></A><H3>
waitForCondition</H3>
<PRE>
public int <B>waitForCondition</B>(int&nbsp;condition_set,
long&nbsp;timeout)</PRE>
<DL>
<DD>This method blocks until certain conditions hold true on the underlying SSH-2 channel.
<p>
This method returns as soon as one of the following happens:
<ul>
<li>at least of the specified conditions (see <A HREF="../../../com/trilead/ssh2/ChannelCondition.html" title="interface in com.trilead.ssh2"><CODE>ChannelCondition</CODE></A>) holds true</li>
<li>timeout > 0 and a timeout occured (TIMEOUT will be set in result conditions)</a>
<li>the underlying channel was closed (CLOSED will be set in result conditions)</a>
</ul>
<p>
In any case, the result value contains ALL current conditions, which may be more
than the specified condition set (i.e., never use the "==" operator to test for conditions
in the bitmask, see also comments in <A HREF="../../../com/trilead/ssh2/ChannelCondition.html" title="interface in com.trilead.ssh2"><CODE>ChannelCondition</CODE></A>).
<p>
Note: do NOT call this method if you want to wait for STDOUT_DATA or STDERR_DATA and
there are concurrent threads (e.g., StreamGobblers) that operate on either of the two
InputStreams of this <code>Session</code> (otherwise this method may
block, even though more data is available in the StreamGobblers).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>condition_set</CODE> - a bitmask based on <A HREF="../../../com/trilead/ssh2/ChannelCondition.html" title="interface in com.trilead.ssh2"><CODE>ChannelCondition</CODE></A> values<DD><CODE>timeout</CODE> - non-negative timeout in ms, <code>0</code> means no timeout
<DT><B>Returns:</B><DD>all bitmask specifying all current conditions that are true</DL>
</DD>
</DL>
<HR>
<A NAME="getExitStatus()"><!-- --></A><H3>
getExitStatus</H3>
<PRE>
public java.lang.Integer <B>getExitStatus</B>()</PRE>
<DL>
<DD>Get the exit code/status from the remote command - if available. Be
careful - not all server implementations return this value. It is
generally a good idea to call this method only when all data from the
remote side has been consumed (see also the <code<WaitForCondition</code> method).
<P>
<DD><DL>
<DT><B>Returns:</B><DD>An <code>Integer</code> holding the exit code, or
<code>null</code> if no exit code is (yet) available.</DL>
</DD>
</DL>
<HR>
<A NAME="getExitSignal()"><!-- --></A><H3>
getExitSignal</H3>
<PRE>
public java.lang.String <B>getExitSignal</B>()</PRE>
<DL>
<DD>Get the name of the signal by which the process on the remote side was
stopped - if available and applicable. Be careful - not all server
implementations return this value.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>An <code>String</code> holding the name of the signal, or
<code>null</code> if the process exited normally or is still
running (or if the server forgot to send this information).</DL>
</DD>
</DL>
<HR>
<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
public void <B>close</B>()</PRE>
<DL>
<DD>Close this session. NEVER forget to call this method to free up resources -
even if you got an exception from one of the other methods (or when
getting an Exception on the Input- or OutputStreams). Sometimes these other
methods may throw an exception, saying that the underlying channel is
closed (this can happen, e.g., if the other server sent a close message.)
However, as long as you have not called the <code>close()</code>
method, you may be wasting (local) resources.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../com/trilead/ssh2/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Session.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
Trilead SSH-2 for Java</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/trilead/ssh2/ServerHostKeyVerifier.html" title="interface in com.trilead.ssh2"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/trilead/ssh2/SFTPException.html" title="class in com.trilead.ssh2"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?com/trilead/ssh2/Session.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Session.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>