How does the Telnet server interact with the client?

I want to write a C # application where it connects to a telnet server and communicates with the server. I was wondering how the telnet server sends information to the client. I looked (took off) over the Telnet RFC and looked at the incoming packets coming from the server, and still got a little confused. Can someone give me an example of how the server moves the cursor in the telnet client and how it can change the colors of characters? (An example would be most appreciated)

Update I

Here are some additional VT100 resources:

Update II

With lots of research and time, here is what I learned: Telnet programming with C #

+4
source share
3 answers

Moving the cursor and changing colors is not performed using the telnet protocol.

Your telnet client emulates a terminal , most likely the VT-100 variant. To move the cursor and change the color, the server sends escape sequences specific to the terminal emulation type (which is sent in the telnet protocol negotiation).

If you do not need these escape sequences, telling the server to negotiate the telnet protocol, you are a "dumb" terminal, that should be enough. If you want them (or if the server assumes that everyone has a VT-100 and always sends them), you will have to implement a VT-100 terminal emulator (or at least enough to refuse what you don't want )

+7
source

A simple Google search reveals many Telnet clients (and another open source network protocol) written in C #. You can simply download the source code and see how they implement the negotiation and connection commands.

+2
source

As for processing the cursor and text colors, etc., now you are talking about terminal emulation. For this you need a library. It seems like a good place to start.

+2
source

All Articles