Java Doc for TelnetClient.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » telnet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache commons net 1.4.1 » org.apache.commons.net.telnet 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.net.telnet.Telnet
   org.apache.commons.net.telnet.TelnetClient

All known Subclasses:   org.apache.commons.net.ftp.FTP,
TelnetClient
public class TelnetClient extends Telnet (Code)
The TelnetClient class implements the simple network virtual terminal (NVT) for the Telnet protocol according to RFC 854. It does not implement any of the extra Telnet options because it is meant to be used within a Java program providing automated access to Telnet accessible resources.

The class can be used by first connecting to a server using the SocketClient org.apache.commons.net.SocketClient.connect connect method. Then an InputStream and OutputStream for sending and receiving data over the Telnet connection can be obtained by using the TelnetClient.getInputStream getInputStream() and TelnetClient.getOutputStream getOutputStream() methods. When you finish using the streams, you must call TelnetClient.disconnect disconnect rather than simply closing the streams.


author:
   Daniel F. Savarese
author:
   Bruno D'Avanzo



Field Summary
protected  booleanreaderThread
    

Constructor Summary
public  TelnetClient()
     Default TelnetClient constructor.
public  TelnetClient(String termtype)
    

Method Summary
 void_closeOutputStream()
    
protected  void_connectAction_()
     Handles special connection requirements.
 void_flushOutputStream()
    
public  voidaddOptionHandler(TelnetOptionHandler opthand)
     Registers a new TelnetOptionHandler for this telnet client to use.
public  voiddeleteOptionHandler(int optcode)
     Unregisters a TelnetOptionHandler.
public  voiddisconnect()
     Disconnects the telnet session, closing the input and output streams as well as the socket.
public  InputStreamgetInputStream()
     Returns the telnet connection input stream.
public  booleangetLocalOptionState(int option)
     Returns the state of the option on the local side.
public  OutputStreamgetOutputStream()
     Returns the telnet connection output stream.
public  booleangetReaderThread()
     Gets the status of the reader thread.
public  booleangetRemoteOptionState(int option)
     Returns the state of the option on the remote side.
public  voidregisterNotifHandler(TelnetNotificationHandler notifhand)
     Registers a notification handler to which will be sent notifications of received telnet option negotiation commands.
public  voidregisterSpyStream(OutputStream spystream)
     Registers an OutputStream for spying what's going on in the TelnetClient session.
public  booleansendAYT(long timeout)
     Sends an Are You There sequence and waits for the result.
public  voidsetReaderThread(boolean flag)
     Sets the status of the reader thread.
public  voidstopSpyStream()
     Stops spying this TelnetClient.
public  voidunregisterNotifHandler()
     Unregisters the current notification handler.

Field Detail
readerThread
protected boolean readerThread(Code)




Constructor Detail
TelnetClient
public TelnetClient()(Code)
Default TelnetClient constructor.



TelnetClient
public TelnetClient(String termtype)(Code)




Method Detail
_closeOutputStream
void _closeOutputStream() throws IOException(Code)



_connectAction_
protected void _connectAction_() throws IOException(Code)
Handles special connection requirements.


exception:
  IOException - If an error occurs during connection setup.




_flushOutputStream
void _flushOutputStream() throws IOException(Code)



addOptionHandler
public void addOptionHandler(TelnetOptionHandler opthand) throws InvalidTelnetOptionException(Code)
Registers a new TelnetOptionHandler for this telnet client to use.


throws:
  InvalidTelnetOptionException -


Parameters:
  opthand - - option handler to be registered.




deleteOptionHandler
public void deleteOptionHandler(int optcode) throws InvalidTelnetOptionException(Code)
Unregisters a TelnetOptionHandler.


throws:
  InvalidTelnetOptionException -


Parameters:
  optcode - - Code of the option to be unregistered.




disconnect
public void disconnect() throws IOException(Code)
Disconnects the telnet session, closing the input and output streams as well as the socket. If you have references to the input and output streams of the telnet connection, you should not close them yourself, but rather call disconnect to properly close the connection.



getInputStream
public InputStream getInputStream()(Code)
Returns the telnet connection input stream. You should not close the stream when you finish with it. Rather, you should call TelnetClient.disconnect disconnect .

The telnet connection input stream.




getLocalOptionState
public boolean getLocalOptionState(int option)(Code)
Returns the state of the option on the local side.


Parameters:
  option - - Option to be checked.

The state of the option on the local side.




getOutputStream
public OutputStream getOutputStream()(Code)
Returns the telnet connection output stream. You should not close the stream when you finish with it. Rather, you should call TelnetClient.disconnect disconnect .

The telnet connection output stream.




getReaderThread
public boolean getReaderThread()(Code)
Gets the status of the reader thread.

true if the reader thread is on, false otherwise




getRemoteOptionState
public boolean getRemoteOptionState(int option)(Code)
Returns the state of the option on the remote side.


Parameters:
  option - - Option to be checked.

The state of the option on the remote side.




registerNotifHandler
public void registerNotifHandler(TelnetNotificationHandler notifhand)(Code)
Registers a notification handler to which will be sent notifications of received telnet option negotiation commands.


Parameters:
  notifhand - - TelnetNotificationHandler to be registered




registerSpyStream
public void registerSpyStream(OutputStream spystream)(Code)
Registers an OutputStream for spying what's going on in the TelnetClient session.


Parameters:
  spystream - - OutputStream on which session activitywill be echoed.




sendAYT
public boolean sendAYT(long timeout) throws IOException, IllegalArgumentException, InterruptedException(Code)
Sends an Are You There sequence and waits for the result.


throws:
  InterruptedException -
throws:
  IllegalArgumentException -
throws:
  IOException -


Parameters:
  timeout - - Time to wait for a response (millis.)

true if AYT received a response, false otherwise




setReaderThread
public void setReaderThread(boolean flag)(Code)
Sets the status of the reader thread. The reader thread status will apply to all subsequent connections


Parameters:
  flag - - true switches the reader thread on, false switches it off




stopSpyStream
public void stopSpyStream()(Code)
Stops spying this TelnetClient.




unregisterNotifHandler
public void unregisterNotifHandler()(Code)
Unregisters the current notification handler.




Fields inherited from org.apache.commons.net.telnet.Telnet
final static int DEFAULT_PORT(Code)(Java Doc)
final protected static int TERMINAL_TYPE(Code)(Java Doc)
final protected static int TERMINAL_TYPE_IS(Code)(Java Doc)
final protected static int TERMINAL_TYPE_SEND(Code)(Java Doc)
final static byte[] _COMMAND_AYT(Code)(Java Doc)
final static byte[] _COMMAND_DO(Code)(Java Doc)
final static byte[] _COMMAND_DONT(Code)(Java Doc)
final static byte[] _COMMAND_IS(Code)(Java Doc)
final static byte[] _COMMAND_SB(Code)(Java Doc)
final static byte[] _COMMAND_SE(Code)(Java Doc)
final static byte[] _COMMAND_WILL(Code)(Java Doc)
final static byte[] _COMMAND_WONT(Code)(Java Doc)
final static int _WILL_MASK_DO_MASK_REQUESTED_WILL_MASK_REQUESTED_DO_MASK(Code)(Java Doc)
int[] _doResponse_willResponse_options(Code)(Java Doc)
final static boolean debug(Code)(Java Doc)
final static boolean debugoptions(Code)(Java Doc)

Methods inherited from org.apache.commons.net.telnet.Telnet
protected void _connectAction_() throws IOException(Code)(Java Doc)
final synchronized void _processAYTResponse()(Code)(Java Doc)
void _processDo(int option) throws IOException(Code)(Java Doc)
void _processDont(int option) throws IOException(Code)(Java Doc)
void _processSuboption(int suboption, int suboptionLength) throws IOException(Code)(Java Doc)
void _processWill(int option) throws IOException(Code)(Java Doc)
void _processWont(int option) throws IOException(Code)(Java Doc)
void _registerSpyStream(OutputStream spystream)(Code)(Java Doc)
final synchronized void _requestDo(int option) throws IOException(Code)(Java Doc)
final synchronized void _requestDont(int option) throws IOException(Code)(Java Doc)
final synchronized void _requestWill(int option) throws IOException(Code)(Java Doc)
final synchronized void _requestWont(int option) throws IOException(Code)(Java Doc)
boolean _requestedDo(int option)(Code)(Java Doc)
boolean _requestedDont(int option)(Code)(Java Doc)
boolean _requestedWill(int option)(Code)(Java Doc)
boolean _requestedWont(int option)(Code)(Java Doc)
final boolean _sendAYT(long timeout) throws IOException, IllegalArgumentException, InterruptedException(Code)(Java Doc)
final synchronized void _sendByte(int b) throws IOException(Code)(Java Doc)
final synchronized void _sendDo(int option) throws IOException(Code)(Java Doc)
final synchronized void _sendDont(int option) throws IOException(Code)(Java Doc)
final synchronized void _sendSubnegotiation(int subn) throws IOException(Code)(Java Doc)
final synchronized void _sendTerminalType() throws IOException(Code)(Java Doc)
final synchronized void _sendWill(int option) throws IOException(Code)(Java Doc)
final synchronized void _sendWont(int option) throws IOException(Code)(Java Doc)
void _setDo(int option)(Code)(Java Doc)
void _setDont(int option)(Code)(Java Doc)
void _setWantDo(int option)(Code)(Java Doc)
void _setWantDont(int option)(Code)(Java Doc)
void _setWantWill(int option)(Code)(Java Doc)
void _setWantWont(int option)(Code)(Java Doc)
void _setWill(int option)(Code)(Java Doc)
void _setWont(int option)(Code)(Java Doc)
void _spyRead(int ch)(Code)(Java Doc)
void _spyWrite(int ch)(Code)(Java Doc)
boolean _stateIsDo(int option)(Code)(Java Doc)
boolean _stateIsDont(int option)(Code)(Java Doc)
boolean _stateIsWill(int option)(Code)(Java Doc)
boolean _stateIsWont(int option)(Code)(Java Doc)
void _stopSpyStream()(Code)(Java Doc)
void addOptionHandler(TelnetOptionHandler opthand) throws InvalidTelnetOptionException(Code)(Java Doc)
void deleteOptionHandler(int optcode) throws InvalidTelnetOptionException(Code)(Java Doc)
public void registerNotifHandler(TelnetNotificationHandler notifhand)(Code)(Java Doc)
public void unregisterNotifHandler()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.