Pseudo terminals (Internet domain)
Many programs do not function properly without a terminal
for standard input and output.
Because a socket is not a terminal,
it is often necessary for processes communicating over the
network to use a pseudo terminal.
A pseudo terminal is
actually a pair of devices, master and slave, which allow a
process to serve as an active agent in communication between
processes and users.
Data written on the slave side of a pseudo
terminal is supplied as input to a process reading from the
master side.
Data written on the master side is given to the slave as input.
In this way, the process manipulating the master side
of the pseudo terminal has control over the information read and
written on the slave side.
The remote login server uses pseudo terminals for remote login sessions. A user logging in to a machine across the network is provided a shell with a slave pseudo terminal as standard input, output, and error. The server process then handles the communication between the programs invoked by the remote shell and the user's local client process. When a user sends an interrupt or quit signal to a process executing on a remote machine, the client login program traps the signal, sends an out-of-band message to the server process which then uses the signal number (sent as the data value in the out-of-band message) to perform a kill(S) on the appropriate process group.