11.7. A Simple TTY Terminal Program

Creating a complete terminal emulator program is not an easy task. While the program is conceptually simple, there are a lot of details that make things difficult. For example, any real terminal emulator needs to understand the escape sequences of the one or more terminals it is emulating, and you generally end up building a small-state machine to handle it. In order to demonstrate the communications portion of a terminal emulator, this section presents a very simple TTY-style terminal program that you can use to connect to a remote machine via either a modem or the TELNET facility.

One of the more interesting problems handled by this program is the "two input stream problem." In a terminal program, the user ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.