mmorse@Z.NSF.GOV ("Michael H. Morse") (05/10/91)
To paraphase my original question: Why can't my system tell the difference between 1) an escape sequence and 2) just an escape key, typed by some people who use my system? For certain people who Telnet to my system (fewer than 5%), escape sequences are interpretted as just an escape. Leo McLaughlin put it most succinctly: | Bad news. As more and more well behaved TCPs are fielded, you will see | systems exhibiting this behavior become more common. What you are | running into is a combination of Nagle's algorithm for TCP writes and a | telnet which is sending the escape sequence character by character to | the network. Basically, Nagle's algorithm says 'Don't clog the network | the network with little packets. If you have data pending | acknowledgement (in your case the ESC) and don't have a MTU-full of | data queued (in your case the rest of the escape sequence) don't send | anything.' | | So, not only is the telnet breaking the escape sequence into different | packets, the TCP is saying don't send the rest of the sequence until the | ESC is acknowledged. Bill Westfield filed this report from cisco: | Quite a while ago, cisco proudly implemented this useful sounding | algorithm, and prompt started running into the most obscure problems | with Function keys. | ... | The users were not happy. The Nagle algorithm is now optional on cisco | terminal servers. James B VanBokkelen reported that FTP Software experienced a similar problem with their Telnet product after implementing the Nagle algorithm. The writers of RFC 1122 (Requirements for Internet Hosts) were apparently aware of this kind of problems, because they gave SHOULD status to the Nagle Algorithm, and MUST status to letting an application turn it off. However, turning off the Algorithm, assuming the implementor has allowed it to be configured, is not really a solution for my users, since many of them are quite naive about computers in general and Telnet and TCP/IP in particular. Based on the responses I received, I would suggest the following additions to RFC1122/1123: 1. Where a terminal emulator is running on a workstation directly on the Internet, the system SHOULD ensure that escape sequences are transmitted in a single TCP packet. This is the solution FTP software implemented for their Telnet, thus preserving the Nagle Algorithm. I'm not too sure how easy this is to implement on other systems. FTP has a problem in that other terminal emulators can run on top of their Telnet, in which case Telnet sees only a character at a time, and probably Nagles them. What makes me optimistic is that 95% of workstations seem to be working this way now (but perhaps they don't Nagle.) 2. For terminal servers, escape sequences should be exempt from the Nagle algorithm. Preferably, they should be transmitted in a single packet, but probably sending them off as fast as possible would also work. Unfortunately, I have a feeling that most terminal server implementors will choose simply not to Nagle (or let their customers configure), thus putting you back with the problem Nagle was designed to solve. This leaves the situation of real terminals connected to hosts, where the user logs on to the host, and then Telnets to my system. I don't really see a good solution for this. An elegant solution might be to define the common escape sequences (cursor movement and function keys) as part of the NVT, but I don't think there would be any enthusiasm for this, since it would require major changes and most of the excitement these days seems to be in GUI's and X terminals. I would remind implementors that RFC1122 says they MUST allow an application to turn off Nagle. Does anyone know how this is done in practice? I don't think a site configuration option really meets this requirement, but perhaps I misinterpret the spec. How about it implementors? Are these things doable? I don't think users will give up their Escape keys without a fight. These days, even vi (in most implementations) accepts function keys (escape sequences) and the Escape key, and uses a timer to distinguish the two. Thanks again to all that responded: Leo McLaughlin, ljm@ftp.com Merton Crockett, mcc@wlv.imsd.contel.com James VanBokkelen, jbvb@ftp.com Lars Poulsen, lars@cmc.com Hal Murray, murray@src.dec.com Ted Doty, dotytr@nscultrix1.network.com Bill Westfield, billw@mathom.cisco.com Don Provan, donp@novell.com --Mike