Socat is a command line based utility that establishes two bidirectional byte streams and transfers data between them. Because the streams can be constructed from a large set of different types of data sinks and sources, and because lots of address options may be applied to the streams, socat can be used for many different purposes.nixCraft
socat can do serial line stuff, and it can do fairly advanced functionality, like having multiple clients listen on a port, or reusing connections. The life cycle of a socat instance typically consists of four phases.
- In the init phase, the command line options are parsed and logging is
initialized.
- During the open phase, socat opens the first address and afterwards
the second address. These steps are usually blocking; thus,
especially for complex address types like socks, connection requests
or authentication dialogs must be completed before the next step is
started.
- In the transfer phase, socat watches both streams' read and write
file descriptors via select() , and, when data is available on one
side and can be written to the other side, socat reads it, performs
newline character conversions if required, and writes the data to the
write file descriptor of the other stream, then continues waiting for
more data in both directions.
- When one of the streams effectively reaches EOF, the closing phase
begins. Socat transfers the EOF condition to the other stream, it
tries to shutdown only its write stream, giving it a chance to
terminate gracefully. For a defined time socat continues to transfer
data in the other direction, but then closes all remaining channels
and terminates.
agetty opens a tty port, prompts for a login name and invokes the /bin/login
command. It is normally invoked by init(8)
. agetty has several non-standard features that are useful for hard-wired and for dial-in lines:ManPage
- Adapts the tty settings to parity bits and to erase, kill,
end-of-line and uppercase characters when it reads a login name. The
program can handle 7-bit characters with even, odd, none or space
parity, and 8-bit characters with no parity. The following special
characters are recognized: @ and Control-U (kill); #, DEL and back
space (erase); carriage return and line feed (end of line).
- Optionally deduces the baud rate from the CONNECT messages produced
by Hayes(tm)-compatible modems.
- Optionally does not hang up when it is given an already opened line
(useful for call-back applications).
- Optionally does not display the contents of the /etc/issue file.
- Optionally displays an alternative issue file instead of /etc/issue.
- Optionally does not ask for a login name.
- Optionally invokes a non-standard login program instead of
/bin/login.
- Optionally turns on hard-ware flow control
- Optionally forces the line to be local with no need for carrier
detect.
- Supports ringback, if desired. The actual procedure that getty uses
is as follows: Initially, getty parses its command line. If no errors
are found, and the tty type from the command line is set to "unknown"
(the default value), or not set, getty checks for the tty type in
/etc/ttytype if the program was compiled with TTYTYPE defined. If a
tty type is found, either on the command line or in the /etc/ttytype
file, then it is placed into the TERM environment variable. Next,
getty scans the defaults file, normally /etc/default/getty, to
determine certain runtime values (/etc/conf.getty if compiled with
FSSTND option). The values in the defaults file (whose compiled-in
name can be altered with the optional -d defaults_file argument) take
precedence to those on the command line. Getty then opens the port
for reading and writing, and disables stdio buffering. If an
initialization was specified, it is performed.
Extra Sources: Socat, agetty MP