简体   繁体   English

如何从telnet或SSH访问c#套接字服务器?

[英]How to access c# sockets server from telnet or SSH?

I've created a very simple sockets server in C# that, when given a number, returns the number doubled. 我已经在C#中创建了一个非常简单的套接字服务器,当给定一个数字时,它会将数字加倍。 I'm using TCPListener. 我正在使用TCPListener。 This server currently works with a simple Winform client I put together, using TCPClient. 该服务器当前使用TCPClient与我放在一起的简单Winform客户端一起使用。

I tried to connect to the server with Absolute Telnet while it was running. 我尝试在服务器运行时使用绝对Telnet连接到服务器。 It connects, however the telnet program doesn't appear to let me enter any text, etc. 它可以连接,但是telnet程序似乎没有让我输入任何文本等。

Should a basic sockets server like this be accessible via a regular telnet or SSH client app? 这样的基本套接字服务器是否可以通过常规的telnet或SSH客户端应用程序访问? If not, what would it take to add that support to my server? 如果没有,那么将这种支持添加到我的服务器需要什么?

A tool like Wireshark is good for debugging network I/O -- it lets you see exactly what packets are entering and leaving your network interface in near real time. 诸如Wireshark之​​类的工具可用于调试网络I / O,它使您可以几乎实时地准确查看正在进入和离开网络接口的数据包。

You definitely don't want to use SSH -- you haven't coded anything to account for SSH authentication or encryption. 您绝对不想使用SSH-您尚未编写任何代码来说明SSH身份验证或加密。

Not necessarily. 不必要。 There are several Telnet protocols in existence and it varies from client to client which one is used by default. 存在多种Telnet协议,并且默认情况下,每个客户端使用的协议不同。 Windows Telnet assumes it's a plain text protocol (straight TCP data transfer) until it sees some data it recognizes as a telnet protocol so if you want to test this app of yours try that. Windows Telnet假定它是纯文本协议(直接TCP数据传输),直到看到被识别为telnet协议的某些数据为止,因此,如果您要测试此应用程序,请尝试使用该协议。 Keep in mind as you type nothing will show up if local echo is turned off and your server doesn't echo. 请记住,如果您关闭本地回显并且服务器没有回显,则键入内容时将不会显示任何内容。

Try to determine the protocols that the SSH and Telnet clients you're using are running and look up their RFCs. 尝试确定正在使用的SSH和Telnet客户端正在运行的协议,并查找其RFC。

您是否打开了“本地回声”?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM