简体   繁体   English

Telnet服务器如何与客户端通信?

[英]How does Telnet server communicate to the client?

I want to write a C# application where it connects to a telnet server and communicates to the server. 我想编写一个C#应用程序,它连接到telnet服务器并与服务器通信。 I was wondering how a telnet server sends information to the client. 我想知道telnet服务器如何向客户端发送信息。 I have looked (skimmed) over the Telnet RFC and looked at the incoming packets coming in from the server and still a bit confused. 我查看(浏览过) Telnet RFC并查看从服务器进来的传入数据包,但仍然有点困惑。 Can somebody give me an example how the server moves the cursor around in the telnet client and how it can change colors of characters? 有人能给我一个例子,说明服务器如何在telnet客户端中移动光标以及它如何改变字符的颜色? (An example would be most appreciated) (最值得赞赏的一个例子)

Update I 更新我

Here's some additional VT100 resources: 这是一些额外的VT100资源:

  1. ANSI/VT100 Terminal Control ANSI / VT100终端控制
  2. vt100_codes_news.txt vt100_codes_news.txt

Update II 更新II

With much research and time, here what I found out: Telnet Programming with C# 经过大量的研究和时间,我发现了这一点: 使用C#进行Telnet编程

Moving the cursor and changing the color isn't done by the telnet protocol. 移动光标并更改颜色不是由telnet协议完成的。

Your telnet client is emulating a terminal , most probably a VT-100 variant. 您的telnet客户端正在模拟终端 ,很可能是VT-100变体。 To move the cursor and change the color, the server sends escape sequences especific to the type of terminal being emulated (which one is sent in the telnet protocol negotiation). 要移动光标并更改颜色,服务器会发送转义序列,特别是要模拟的终端类型(哪一个是在telnet协议协商中发送的)。

If you don't want these escape sequences, telling the server on the telnet protocol negotiation you are a "dumb" terminal should be enough. 如果你不想要这些转义序列,告诉服务器telnet协议协商你是一个“哑”终端应该就够了。 If you want them (or if the server assumes everyone has a VT-100 and always sends them) you will have to implement a VT-100 terminal emulator (or at least enough of it to discard what you don't want). 如果你想要它们(或者如果服务器假设每个人都有VT-100并且总是发送它们),你将不得不实现VT-100终端模拟器(或者至少足以丢弃你不想要的东西)。

A simple Google search reveals many open source Telnet (and other network protocol) clients written in C#. 一个简单的谷歌搜索揭示了许多用C#编写的开源Telnet(和其他网络协议)客户端。 You could just download the source code to one and see how they implement connection negotiation and commands. 您可以将源代码下载到一个,看看它们如何实现连接协商和命令。

With respect to handling the cursor and text colours, etc., now you are talking about terminal emulation. 关于处理光标和文本颜色等,现在你谈论终端仿真。 For that you will need a library. 为此你需要一个图书馆。 This looks like a good place to start. 这看起来是个好地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TCP连接到路由器如何通讯? (Telnet客户端) - tcp connection to router how to communicate? (Telnet Client) 服务器如何知道要与之通信的特定客户端的地址? - how does the server comes to know about the address of a particular client to which it wants to communicate? 在服务器和客户端之间交流进度 - Communicate progress between server and client 如何使用udp从c#客户端与c服务器通信? - how to communicate with c server from c# client using udp? 如何在CE 6.0设备(作为服务器)和PC(作为客户端)之间进行通信 - How to communicate between CE 6.0 device (as server) and PC (as client) 如何使用ASP.NET Hosting在Nancy中使用SignalR将服务器与客户端通信? - How to communicate Server to Client with SignalR in Nancy with ASP.NET Hosting? 客户端Flash(SWF)应该如何与服务器端.NET通信? - How should client Flash(SWF) communicate with server-side .NET? 我的客户端上的应用程序如何与服务器上的数据库进行通信 - How could my application on client communicate database on server 客户端如何与具有多个适配器的计算机上的Windows服务通信? - How does a client communicate with a Windows Service on a machine with multiple adapters? 如何与SFTP服务器通信 - How to communicate with SFTP server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM