Package com.iizix.term.comm
Class TelnetComm
- java.lang.Object
- com.iizix.term.comm.TelnetComm
 
- public class TelnetComm extends java.lang.ObjectClass to handle the Telnet protocol for 3270 and 5250.- Author:
- Christopher Mindus
 
- Constructor Summary- Constructors - Constructor - Description - TelnetComm(SessionInfo sessionInfo, TelnetCommProps properties, boolean is3270, Worker worker, TelnetCommListener listener, javax.net.ssl.SSLEngine engine)Creates a new Telnet Client Communication channel as UNINITIALIZED.
 - Method Summary- All Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - boolean- close()Call this method to close the socket.- CodepageConverter- getCodepageConverter()Gets the codepage converter for EBCDIC characters.- java.lang.String- getDeviceName()Gets the device name of the session.- TelnetCommProps- getProperties()Gets the Telnet properties.- SocketCommNIO- getSocketCommNIO()Gets the NIO Socket Communication instance.- SocketCommNIO.State- getState()Gets the state of the connection.- java.lang.String- getTerminalType()Gets the negotiated terminal type, null for none.- boolean- hasBeenOpen()Checks if the session has been opened, and if so cannot be reopened but needs to have a new instance.- boolean- isClosed()Checks if the connection is disposed of.- void- open()Opens the communication.- boolean- sendSpecialKey(int param)Sends TN3270E special key (param=0 is Attention and param=1 is SysReq).- void- sendSSCPLUData(byte[] buf, int n)Sends SSCP LU data for a TN3270E session.- void- write(byte[] buf)Writes a raw buffer to the output followed by a flush.- void- write(byte[] buf, int n)Writes an amount of bytes.- void- writeRaw(byte[] buf)Writes a raw buffer to the output followed by a flush.- void- writeRaw(byte[] buf, int count)Writes a raw buffer to the output followed by a flush.
 
- Constructor Detail- TelnetComm- public TelnetComm(SessionInfo sessionInfo, TelnetCommProps properties, boolean is3270, Worker worker, TelnetCommListener listener, javax.net.ssl.SSLEngine engine) throws java.io.IOException Creates a new Telnet Client Communication channel as UNINITIALIZED.- Parameters:
- sessionInfo- Session information.
- properties- The Telnet properties.
- is3270- Flag for 3270.
- worker- The worker thread for socket processing.
- listener- The listener for Telnet events.
- engine- The SSL engine, or null for plain socket.
- Throws:
- java.io.IOException- for I/O errors.
 
 
 - Method Detail- getSocketCommNIO- public SocketCommNIO getSocketCommNIO() Gets the NIO Socket Communication instance.- Returns:
- The socket communication instance.
 
 - getTerminalType- public java.lang.String getTerminalType() Gets the negotiated terminal type, null for none.- Returns:
- The terminal type, null for none.
 
 - getProperties- public TelnetCommProps getProperties() Gets the Telnet properties.- Returns:
- The telnet settings.
 
 - getCodepageConverter- public CodepageConverter getCodepageConverter() Gets the codepage converter for EBCDIC characters.- Returns:
- The codepage converter.
 
 - open- public void open() throws java.io.IOExceptionOpens the communication.- Throws:
- java.io.IOException- For I/O errors.
 
 - hasBeenOpen- public boolean hasBeenOpen() Checks if the session has been opened, and if so cannot be reopened but needs to have a new instance.- Returns:
- true if opened.
 
 - getState- public SocketCommNIO.State getState() Gets the state of the connection.- Returns:
- Connection state.
 
 - isClosed- public boolean isClosed() Checks if the connection is disposed of.- Returns:
- true for closed.
 
 - close- public boolean close() Call this method to close the socket.- Returns:
- true if closed, false if already closed.
 
 - write- public void write(byte[] buf) throws java.io.IOExceptionWrites a raw buffer to the output followed by a flush.- Parameters:
- buf- Data to send.
- Throws:
- java.io.IOException- For send failures.
 
 - write- public void write(byte[] buf, int n) throws java.io.IOExceptionWrites an amount of bytes. The data is appended with and end-of-record (IAC EOR). Each 0xFF character in the buffer is escaped with 0xFF (i.e. IAC IAC).- Parameters:
- buf- The byte array to write.
- n- Count of bytes to write.
- Throws:
- java.io.IOException- if an I/O error occurs.
 
 - writeRaw- public void writeRaw(byte[] buf) throws java.io.IOExceptionWrites a raw buffer to the output followed by a flush.- Parameters:
- buf- The byte buffer.
- Throws:
- java.io.IOException- for send IO failures.
 
 - writeRaw- public void writeRaw(byte[] buf, int count) throws java.io.IOExceptionWrites a raw buffer to the output followed by a flush.- Parameters:
- buf- The byte buffer.
- count- The count of bytes from beginning of buffer to write.
- Throws:
- java.io.IOException- for send IO failures.
 
 - getDeviceName- public java.lang.String getDeviceName() Gets the device name of the session.- Returns:
- null if no device name exists.
 
 - sendSSCPLUData- public void sendSSCPLUData(byte[] buf, int n) throws java.io.IOExceptionSends SSCP LU data for a TN3270E session.- Parameters:
- buf- The buffer.
- n- The count of bytes.
- Throws:
- java.io.IOException- if an I/O error occurs.
 
 - sendSpecialKey- public boolean sendSpecialKey(int param) throws java.io.IOExceptionSends TN3270E special key (param=0 is Attention and param=1 is SysReq).- Parameters:
- param- The special send key.
- Returns:
- false if this special key is not supported.
- Throws:
- java.io.IOException- if an I/O error occurs.