Subject: Re: Strange boot message
To: Curt Sampson <cjs@cynic.net>
From: Andrew Brown <atatat@atatdot.net>
List: port-i386
Date: 01/21/2003 00:00:08
>> laggy network also sounds reasonable, except until you consider that
>> when i press the up arrow, all three characters are sent *at once*. i
>> just don't get it.
>
>Quite possibly they aren't sent all at once. If your TCP stack is
>optimizing for interactive performance, and your application writes
>the three characters separately, the first character may get sent
>immediately on the first write, and the following ones could end up in a
>separate packet.
(1) the xterm receives a "down" keypress event, causing it, i suppose,
to write "^[[B" to the master side of the pty.
(2) on the slave side, that comes out as one read of three characters.
there's no reason for that to be anything but a single read.
(3) typically i'm using ssh at this point, so that gets packaged as a
single ssh packet.
(4) then it goes out over the wire (possibly getting getting
fragmented, however unlikely that would be, but it would later have to
be reassembled anyway) as a single packet, and arrives as a single
packet.
(5) ssh handles it as a single packet, and writes it out to the master
side of the pty as "^[[B".
(6) vi is now the application (on the remote machine), and it should
get the three characters in a single read.
after thinking this through in such great detail (and checking), i can
see that step 1 is handled by the xterm in three single character
writes, leaving the behavior of step 2 up for grabs, and the behavior
of all subsequent steps basically revolves around that. suck.
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
werdna@squooshy.com * "information is power -- share the wealth."