问题
I am writing a telnet proxy on xp. Now I can telnet to system's telnet server and print its return values sending back to my procedure.
I find a very puzzling phenomenon. When I first telnet to the server,it will ask me to log in. I type in "tamlok"
, and I can see that it sending back to me that "116,97,109,108,111,107,10,13"
which is the ascii value of "tamlok"(10 and 13 means '\n' and '\r')
.
However after I log in,I type in "tamlok"
again. It sends back to me that "27,91,56,59,51,52,72,116,0,97,0,108,0,111,0,107,0,27,91,57,59,49,72"
.
I suggest that it returns the unicode so that "116"
turns into "116,0"
and so on. But I can't understand the sequence "27,91,56,59,51,52,72"
and "27,91,57,59,49,72"
. I think it maybe a sequence for a special function, just like {0x1B, 0x5B, 0x48, 0x1B, 0x5B, 0x4A}
will clear the console.
So,how to interpret this? Any help is welcome!
回答1:
Thanks to Joachim Pileborg.Now it is clear that it is terminal control codes. An example. So "27,91,56,59,51,52,72" is "[Esc][8;34H" which suits the pattern: Cursor Home [{ROW};{COLUMN}H Sets the cursor position where subsequent text will begin. If no row/column parameters are provided (ie. [H), the cursor will move to the home position, at the upper left of the screen. So does 27,91,57,59,49,72".
来源:https://stackoverflow.com/questions/10142720/about-the-return-values-of-the-telnet-server-on-windows-xp