Telnet Interrupt Handling Using Out-Of-Band Signaling: The Telnet Synch Function
(Page 1 of 2)
All the bytes of data sent from a Telnet client to a server are received in the order that they were sent, and vice-versa. This is, of course, the way we expect an application to operate; in fact, ensuring that data is not received out-of-order is one of the jobs that we assume of the reliable transport protocol TCP, over which Telnet runs. However, this can cause a problem for Telnet because of the way the protocol sends both data and commands over the same connection.
The most important case where the issue of all data being received in order arises is when a user needs to interrupt a process. Suppose as an example that you are using Telnet to run an interactive program that takes user input, processes it, and then produces output. You are merrily typing away when you notice that you havent seen any output from the program for a while. It has apparently hung up due to a programming error or other glitch.
If you were using the program on a directly-connected terminal, you would simply use the key or keystroke command appropriate to that terminal to interrupt or kill the process and restart it. Instead, you are using Telnet, so you enter the appropriate keystroke, which gets converted to the special Telnet Interrupt Process command code (byte value 244, preceded by the Telnet Interpret As Command code, 255).
Since Telnet uses only a single stream for commands and data, that code is placed into the TCP data stream to be sent over to the Telnet server. Since you were entering data for a while, that Telnet Interrupt Process code will be sitting behind a bunch of regular data bytes. Now, the remote process has stopped reading this data, which means the TCP receive buffer on the server will start to fill up. The Interrupt Process command will thus remain stuck in the buffer, waiting to be read. In fact, if the number of data bytes in front of the command is high enough, the TCP buffer on the server may fill entirely, causing the server to close the clients TCP send window. This means the Interrupt Process command will wait in the clients outgoing TCP queue and never even be sent to the remote host at all!
Obviously, what we need here is some way to be able to flag the Interrupt Process command, so that it can be sent to the remote host regardless of the number of data bytes outstanding in front of it. If youve already perused the large section of this Guide devoted to TCP, you may now be thinking that you have already read about a feature of that protocol that seems ideally suited for this exact problem and youd be correct! The TCP urgent function allows an important piece of data to be marked so that it is given priority over regular data, a process sometimes called out-of-band signaling (because the signal is outside the normal data stream). Telnet makes use of this feature of TCP to define what it calls the synch function.
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.