1

There is a linux server that establishes a telnet session with a device. The device is using a vt100 terminal emulator to communicate with the server.

I want to use a c# program that establishes a telnet session with the server instead of using the terminal emulator. I want to display a much nicer graphical user interface on the device using the same telnet session the terminal emulator was using without changing any of the code on the server.

This is an example of what the server is sending over the telnet session. Is it possible to extract out the meaningful data and display it using c# labels/buttons/etc...?

[1;1H[7mRF ID - V2.03D[608][2;1H[mxlqqqqqqqqqqqqqqk[2;19Hx[3;1HxxKey

Telecaster
  • 107
  • 2
  • 8
  • 5
    You have my sympathy. – Dai Mar 27 '13 at 19:10
  • 1
    Yes, it is possible. [whathaveyoutried.com](http://whathaveyoutried.com)? – Ondrej Tucny Mar 27 '13 at 19:11
  • I have found the termcap file that the server uses to define how to send the data back to the emulator depending on the terminal type. I thought about using this to create a class that would parse out the meaningful data for me but the termcap file contains definitions like ":G2=l:\" and that does not make any sense to me. – Telecaster Mar 27 '13 at 19:21
  • @Telecaster that's the difference between windows and linux. Windows is intended to be used by human beings. – Federico Berasategui Mar 27 '13 at 19:23

1 Answers1

1

Interpretting VT100 escape sequences is simple. They're well documented: http://graphcomp.com/info/specs/ansi_col.html

What you want to do with it is likely going to be more complex than you realize. If I were you, I would build an internal model of a screen and update that model based on the VT100 codes you get. That should help you to maintain a consistent "view" of what your app should be seeing.

Update: Lots more info here: http://www.vt100.net/ You may find this particularly helpful: http://www.vt100.net/docs/vt102-ug/chapter5.html

Pete
  • 6,585
  • 5
  • 43
  • 69