First obstacle was finding what the key mapping was. I found this on midrange.com. "CTRL+A maps to "Escape, A". [link]
Using TelnetWrapper library here: [link]
I found the Escape Key value here: [link]
What confused me at first was the use of the word "Escape" in the Telnet specification. There are special escaped keys that would normally use the TelnetProtocolHandler's sendTelnetControl(byte code) function. This is not the case. Here's how I did it:
TelnetWrapper t = new TelnetWrapper();
t.connect(hst, prt);
t.waitfor("User . . . . . . . . . . . . . .");
t.send(user + "\t" + pwd);
byte[] b = new byte[] {'\033', 'a'};
t.write(b);
System.out.println(t.waitfor(""));
-Tres
No comments:
Post a Comment