Terminal Emulation

Description
A terminal emulator is a piece of software that mimics the functions of a terminal: a box with a screen and keyboard used to connect to a large computer system (a host).

3270s are a family of block-mode terminals used to interact with IBM mainframes. A block-mode terminal allows text to be edited on the screen without interacting with the host. Specific keys cause the updated text to be sent to the host, and the terminal waits for a response with the keyboard locked.

By contrast, a character-mode terminal sends each keystroke to the host for processing. The terminal sends keystrokes and the host sends text to be displayed without any synchronization.

x3270 and its variants can emulate both a 3270 block-mode terminal and a character-mode terminal.

x3270 communicates with the host using a TCP session over a network. The basic protocol for the session is TELNET.

In addition, the TCP session can be encrypted and authenticated using TLS.

Protocol stack
x3270 is part of a stack of layered protocols. The  green  items are implemented by x3270. The items with the purple background are optional.

NVT mode
All TELNET sessions are initially in Network Virtual Terminal (NVT) mode. In NVT mode, the host sees the session as a pure character-mode terminal. In NVT mode, x3270 emulates an xterm, which is based on the DEC VT100 and VT220 serial terminals. It sends and receives data using UTF-8 encoding.

NVT mode has two sub-modes. The default is line mode, where the terminal collects a line of input until the user presses the Return key, then sends the input to the host. For line mode, various control characters are used to backspace, erase words, etc., and these are all configurable in x3270. The host can also negotiate character-at-a-time mode, where each individual keystroke is sent to the host immediately, and it is up to the host to echo them back to the display.

x3270 can be used to communicate with non-IBM hosts using NVT mode. Some IBM hosts also use NVT mode to present an initial menu that is used to select a particular service to connect to.

The interactive emulators (x3270, c3270, wc3270, wx3270) indicate NVT mode with an N near the left side of the Operator Information Area at the bottom of the screen.

3270 mode
An IBM host must initiate a switch to 3270 mode, using TELNET option negotiation. It either uses RFC-1576 or RFC-2355 (TN3270E). In 3270 mode, x3270 emulates a block-mode 3278 (monochrome) or 3279 (color) terminal. The 3270 Data Stream Protocol is used to exchange messages with the host. Text is encoded in EBCDIC, using a configurable host code page.

The interactive emulators indicate 3270 mode with either an A near the left side of the Operator Information Area (if RFC-1576 was used) or a B (if TN3270E was used).

TN3270E supports an additional sub-mode, SSCP-LU mode. SSCP-LU mode still uses EBCDIC encoding, but the terminal behaves more like NVT line mode, gathering a line of input and forwarding it to the host when the Return key is pressed. SSCP-LU mode is indicated by an S in the Operator Information Area.