Package com.iizix.term.comm
Class TelnetComm
java.lang.Object
com.iizix.term.comm.TelnetComm
Class to handle the Telnet protocol for 3270 and 5250.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorDescriptionTelnetComm
(SessionInfo sessionInfo, TelnetCommProps properties, boolean is3270, Worker worker, TelnetCommListener listener, SSLEngine engine) Creates a new Telnet Client Communication channel as UNINITIALIZED.Method Summary
Modifier and TypeMethodDescriptionboolean
close()
Call this method to close the socket.Gets the codepage converter for EBCDIC characters.Gets the device name of the session.Gets the Telnet properties.Gets the NIO Socket Communication instance.getState()
Gets the state of the connection.Gets the negotiated terminal type, null for none.boolean
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 Details
TelnetComm
public TelnetComm(SessionInfo sessionInfo, TelnetCommProps properties, boolean is3270, Worker worker, TelnetCommListener listener, SSLEngine engine) throws 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:
IOException
- for I/O errors.
Method Details
getSocketCommNIO
Gets the NIO Socket Communication instance.- Returns:
- The socket communication instance.
getTerminalType
Gets the negotiated terminal type, null for none.- Returns:
- The terminal type, null for none.
getProperties
Gets the Telnet properties.- Returns:
- The telnet settings.
getCodepageConverter
Gets the codepage converter for EBCDIC characters.- Returns:
- The codepage converter.
open
Opens the communication.- Throws:
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
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
Writes a raw buffer to the output followed by a flush.- Parameters:
buf
- Data to send.- Throws:
IOException
- For send failures.
write
Writes 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:
IOException
- if an I/O error occurs.
writeRaw
Writes a raw buffer to the output followed by a flush.- Parameters:
buf
- The byte buffer.- Throws:
IOException
- for send IO failures.
writeRaw
Writes 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:
IOException
- for send IO failures.
getDeviceName
Gets the device name of the session.- Returns:
- null if no device name exists.
sendSSCPLUData
Sends SSCP LU data for a TN3270E session.- Parameters:
buf
- The buffer.n
- The count of bytes.- Throws:
IOException
- if an I/O error occurs.
sendSpecialKey
Sends 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:
IOException
- if an I/O error occurs.