Clear output in telnet

Is there a way to make a telnet application to clean up the client-side output (using the Java Socket + Buffers connection)? For example, a program asks for a connected user for login and password, and when they manage to log in, I do it clsfor Windows or clearfor Linux.

+3
source share
3 answers

The telnet application is a terminal emulator. In the really old days, the only way to communicate with a computer was to use a terminal with a clean text screen and keyboard. The terminal sent everything that you typed to the computer. The computer sent characters that were printed on the screen. Like telnet. DEC has created a number of terminals called VT52, VT100, etc. They were able to interpret special escape sequences so that the computer could give finer instructions to the terminal. These escape sequences have been standardized by ANSI and are now called ANSI escape codes. Terminal emulators that understand VT100 escape codes are called VT100 terminal emulators.

ansi . [ . - "2J". , , telnet:

myOutputStream.print("\u001B[2J");
myOutputStream.flush();

. "\ u001B [7m", .

+6

Linux , , . VT Esc]2J. , Windows - .

+1

Scrolling through empty lines is the only way I can think in Java if you need to support windows.

0
source

Source: https://habr.com/ru/post/1795788/


All Articles