Question

I have created a telnet client using apache.commons.net.using this I can send remote commands and get the terminal output as string.But Now I also want to edit the remote files.I have vi and ed editors on the remote system.How can I do this.I am using input and output stream to execute other commands and get results like this :

in = telnet.getInputStream();
out = new PrintStream(telnet.getOutputStream());

Please help..

Was it helpful?

Solution

To do this your Java program will need to fully emulate a terminal type recognized by the host system. That means keeping track of all the escape sequences sent by the server and keeping track of what is on the virtual screen and where the cursor is. Then you need to send the appropriate character sequences to control cursor movement, and process (and validate) the feedback from vi to accomplish the editing operations.

This will involve a deep dive into the mechanics of terminal emulation.

Try a Google search for "Java vt100 emulator" to get you started. There are several projects out there that might provide a starting point.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top