public class TelnetSession extends Object implements CliSession
TelnetSession c = new TelnetSession("127.0.0.1", 23);
| Constructor and Description |
|---|
TelnetSession(NedWorker worker)
Constructor for Telnet session object.
|
TelnetSession(NedWorker worker,
int readTimeout,
NedTracer tracer,
NedConnectionBase conn)
Constructor with an extra argument for a readTimeout timer.
|
TelnetSession(NedWorker worker,
NedTracer tracer,
NedConnectionBase conn)
Constructor for Telnet session object.
|
TelnetSession(NedWorker worker,
String username,
int readTimeout,
NedTracer tracer,
NedConnectionBase conn)
Constructor with extra user name argument.
|
TelnetSession(String host,
int port)
Deprecated.
|
TelnetSession(String host,
int port,
int readTimeout,
NedTracer tracer,
NedConnectionBase conn)
Deprecated.
|
TelnetSession(String host,
int port,
NedTracer tracer,
NedConnectionBase conn)
Deprecated.
|
TelnetSession(String host,
int port,
String username,
int readTimeout,
NedTracer tracer,
NedConnectionBase conn)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
expect(Pattern p) |
NedExpectResult |
expect(Pattern[] p) |
NedExpectResult |
expect(Pattern[] p,
boolean include,
int timeout) |
NedExpectResult |
expect(Pattern[] p,
boolean include,
int timeout,
boolean full) |
NedExpectResult |
expect(Pattern[] p,
boolean include,
int timeout,
boolean full,
NedWorker worker) |
NedExpectResult |
expect(Pattern[] p,
boolean include,
int timeout,
NedWorker worker) |
NedExpectResult |
expect(Pattern[] p,
NedWorker worker) |
String |
expect(Pattern p,
boolean include,
int timeout) |
String |
expect(Pattern p,
boolean include,
int timeout,
NedWorker worker) |
String |
expect(Pattern p,
NedWorker worker) |
String |
expect(String Str)
Read from socket until Pattern is encountered.
|
NedExpectResult |
expect(String[] Str) |
NedExpectResult |
expect(String[] Str,
boolean include,
int timeout) |
NedExpectResult |
expect(String[] Str,
boolean include,
int timeout,
NedWorker worker) |
NedExpectResult |
expect(String[] Str,
NedWorker worker) |
String |
expect(String str,
boolean include,
boolean full,
int timeout)
Read from socket until Pattern is encountered.
|
String |
expect(String str,
boolean include,
boolean full,
int timeout,
NedWorker worker) |
String |
expect(String Str,
boolean Include,
int timeout)
Read from socket until Pattern is encountered.
|
String |
expect(String Str,
boolean Include,
int timeout,
NedWorker worker) |
String |
expect(String Str,
int timeout)
Read from socket until Pattern is encountered.
|
String |
expect(String Str,
int timeout,
NedWorker worker) |
String |
expect(String Str,
NedWorker worker) |
void |
flush()
Signals that the final chunk of data has be printed to the output
transport stream.
|
Socket |
getSocket()
Needed by users that need to monitor a socket for EOF .
|
void |
print(String s)
Prints text to the output stream.
|
void |
println(String s)
Print text to the output stream.
|
boolean |
ready()
Tell whether this transport is ready to be read.
|
boolean |
ready(int timeout) |
boolean |
serverSideClosed()
given a live session, check if the server side has
closed it's end of the socket.
|
void |
setScreenSize(int width,
int length) |
void |
setTracer(NedTracer tracer) |
void |
write(String s) |
public TelnetSession(NedWorker worker) throws IOException
worker - current NedWorker objectIOException@Deprecated public TelnetSession(String host, int port) throws IOException
IOExceptionpublic TelnetSession(NedWorker worker, NedTracer tracer, NedConnectionBase conn) throws IOException
worker - current NedWorker objecttracer - Ned tracerconn - NedConnection objectIOException@Deprecated public TelnetSession(String host, int port, NedTracer tracer, NedConnectionBase conn) throws IOException
IOExceptionpublic TelnetSession(NedWorker worker, int readTimeout, NedTracer tracer, NedConnectionBase conn) throws IOException
worker - current NedWorker objectreadTimeout - timeout in millisecondstracer - Ned tracerconn - NedConnection objectIOException@Deprecated public TelnetSession(String host, int port, int readTimeout, NedTracer tracer, NedConnectionBase conn) throws IOException
host - port - readTimeout - Time to wait for read. (in milliseconds)tracer - conn - IOExceptionpublic TelnetSession(NedWorker worker, String username, int readTimeout, NedTracer tracer, NedConnectionBase conn) throws IOException
worker - current NedWorker objectusername - readTimeout - timeout in millisecondstracer - Ned tracerconn - NedConnection objectIOException@Deprecated public TelnetSession(String host, int port, String username, int readTimeout, NedTracer tracer, NedConnectionBase conn) throws IOException
host - port - username - readTimeout - tracer - conn - IOExceptionpublic void setScreenSize(int width,
int length)
throws IOException
IOExceptionpublic String expect(String Str, boolean Include, int timeout) throws IOException
expect in interface CliSessionStr - is a regular expression pattern which is match against
each line read.Include - controls if the pattern should be include
in the returned string or not.IOExceptionpublic String expect(Pattern p, boolean include, int timeout) throws IOException
IOExceptionpublic String expect(String Str, boolean Include, int timeout, NedWorker worker) throws IOException
IOExceptionpublic String expect(Pattern p, boolean include, int timeout, NedWorker worker) throws IOException
IOExceptionpublic String expect(String Str) throws IOException
expect in interface CliSessionStr - is a regular expression pattern which is match against
each line read.IOExceptionpublic String expect(Pattern p) throws SSHSessionException, IOException
expect in interface CliSessionSSHSessionExceptionIOExceptionpublic String expect(String Str, NedWorker worker) throws IOException
expect in interface CliSessionIOExceptionpublic String expect(Pattern p, NedWorker worker) throws SSHSessionException, IOException
expect in interface CliSessionSSHSessionExceptionIOExceptionpublic String expect(String Str, int timeout) throws IOException
expect in interface CliSessionStr - is a regular expression pattern which is match against
each line read.timeout - indicates the read timeoutIOExceptionpublic NedExpectResult expect(String[] Str) throws IOException
expect in interface CliSessionIOExceptionpublic NedExpectResult expect(Pattern[] p) throws SSHSessionException, IOException
expect in interface CliSessionSSHSessionExceptionIOExceptionpublic NedExpectResult expect(String[] Str, boolean include, int timeout) throws IOException
expect in interface CliSessionIOExceptionpublic NedExpectResult expect(Pattern[] p, boolean include, int timeout) throws IOException
expect in interface CliSessionIOExceptionpublic String expect(String Str, int timeout, NedWorker worker) throws IOException
expect in interface CliSessionIOExceptionpublic NedExpectResult expect(String[] Str, NedWorker worker) throws IOException
expect in interface CliSessionIOExceptionpublic NedExpectResult expect(Pattern[] p, NedWorker worker) throws SSHSessionException, IOException
expect in interface CliSessionSSHSessionExceptionIOExceptionpublic NedExpectResult expect(String[] Str, boolean include, int timeout, NedWorker worker) throws IOException
expect in interface CliSessionIOExceptionpublic NedExpectResult expect(Pattern[] p, boolean include, int timeout, NedWorker worker) throws IOException
expect in interface CliSessionIOExceptionpublic NedExpectResult expect(Pattern[] p, boolean include, int timeout, boolean full) throws IOException
IOExceptionpublic NedExpectResult expect(Pattern[] p, boolean include, int timeout, boolean full, NedWorker worker) throws IOException
IOExceptionpublic String expect(String str, boolean include, boolean full, int timeout) throws IOException
expect in interface CliSessionstr - is a regular expression pattern which is match against
each line read.include - controls if the pattern should be include
in the returned string or not.full - controls if the pattern should be matched against
the entire line, or if a positive match is accepted whenever the
pattern matches any substring on a line.IOExceptionpublic String expect(String str, boolean include, boolean full, int timeout, NedWorker worker) throws IOException
expect in interface CliSessionIOExceptionpublic void close()
close in interface CliSessionpublic void write(String s) throws IOException
IOExceptionpublic void print(String s) throws IOException
print in interface CliSessions - Text to send to the stream.IOExceptionpublic void println(String s) throws IOException
println in interface CliSessions - Text to send to the stream.IOExceptionpublic void flush()
throws IOException
flush in interface CliSessionIOExceptionpublic Socket getSocket()
public boolean ready()
throws IOException
IOExceptionpublic boolean ready(int timeout)
throws IOException
IOExceptionpublic boolean serverSideClosed()
serverSideClosed in interface CliSessionpublic void setTracer(NedTracer tracer)
setTracer in interface CliSession