Balvonas
Balvonas

Reputation: 189

send escape key character with java via telnet

I have class which communicates with router through telnet protocol. I can send text strings:

    s = new Socket("201.20.2.3",23);
inputStream = s.getInputStream();
outputStream = s.getOutputStream();
outputStream.write( ("admin\n") .getBytes());
Thread.sleep(100);
outputStream.write("24\n".getBytes());

So \n acts like an Enter button. But how to send an Escape button there?

Upvotes: 0

Views: 2714

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409166

Send the ASCII code for escape: 0x1b.

Upvotes: 4

Related Questions