| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Telnet Protocol Commands (Page 2 of 3) Escaping Commands and the Interpret As Command (IAC) Character All Telnet commands are sent in the same communication stream as regular data; they are represented using special byte values in the range from 240 to 254. To differentiate between data bytes of these values and Telnet commands, every command is preceded by a special escape character, given the name Interpret As Command (IAC). IAC has a value of 255; when the recipient sees this character, it knows the next byte is a command and not data. So, since the Telnet Interrupt Process command has the value 244, to send this command the Telnet client would transmit the byte 255 and then 244. If the actual data byte value 255 needs to be sent, it is transmitted as two 255 bytes. Some Telnet commands also include additional bytes data, which are sent after the command code itself; a good example is the use of parameters in Telnet option negotiation. You may be wondering at this point why the IAC character is needed at all. After all, Telnet uses US ASCII, which is 7-bit data in the byte range of 0 to 127, and the Telnet commands have values higher than 127. One general rationale for using the IAC escape is to be explicit that a command is being sent. A more specific reason is to accommodate the optional sending of 8-bit binary data over Telnet, which the client and server can negotiate. If this mode were enabled and commands were not preceded by the IAC character, this would require all data bytes with values from 240 to 255 to be somehow marked so they would be interpreted as data and not commands. It is more efficient to include an extra byte for commands than data, since they are sent less frequently. By escaping commands, only data byte value 255 requires two bytes to be sent.
Home - Table Of Contents - Contact Us The TCP/IP Guide (http://www.TCPIPGuide.com) Version 3.0 - Version Date: September 20, 2005 © Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved. Not responsible for any loss resulting from the use of this site. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||