Telnet is a service designed to allow you to log onto a remote computer on the Internet. Telnet gives you a "virtual terminal" on the remote computer. The purpose of the TELNET Protocol is to provide a fairly general,bi-directional, eight-bit byte oriented communications facility.
It is envisioned that the protocol may also be used for terminal-terminal communication and process-process communication.As much as possible, the TELNET protocol has been made server-user symmetrical so that it easily and naturally covers the user-user (linking) and server-server (cooperating processes) cases
The TELNET Protocol is built upon three main ideas:
- Network Virtual Terminal :- NVT is an imaginary device which provides a standard,network-wide, intermediate representation of a canonical terminal.This eliminates the need for "server" and "user" hosts to keep information about the characteristics of each other's terminals and terminal handling conventions.
- Principle of negotiated options:- To provide additional sevices over the NVT. Either party (or both) initiate a request that some option take effect.The other party may then either accept or reject the request. If the request is accepted the option immediately takes effect.
- Symmetric view of terminals and processes :-The symmetry of the
negotiation syntax can potentially lead to nonterminating
acknowledgment loops --
each party seeing the incoming commands not as acknowledgments but as new
requests which must
be acknowledged.To
prevent such loops, the following rules prevail:
- party may not send out a "request" merely to announce what mode it is in.
- If a party is already in the requested mode, the request should not be acknowledged.
- rejected requests should not be repeated until some condition changes.
TRANSMISSION OF DATA
Although a TELNET connection through the network is intrinsically full duplex, the NVT is to be viewed as a half-duplex device operating in a line-buffered mode. Default setting is as following
- Data should be accumulated in the host where it is generated until a complete line of data is ready for transmission, or until some locally-defined explicit signal to transmit occurs.
- when a process at one end of a TELNET connection cannot proceed without input from the other end, the process must transmit the TELNET Go Ahead (GA) command.
TELNET COMMAND STRUCTURE
All TELNET commands consist of at least a two byte sequence: the "Interpret as Command" (IAC) escape character followed by the code for the command. The commands dealing with option negotiation are three byte sequences, the third byte being the code for the option referenced.
CONNECTION ESTABLISHMENT
The TELNET TCP connection is established between the user's port U and the server's port L. The server listens on its well known port L for such connections. Since a TCP connection is full duplex and identified by the pair of ports, the server can engage in many simultaneous connections involving its port L and different user ports U.
For more details refer RFC 854