Telnet客户端没有收到。 Python telnetlib作为服务器

问题描述 投票:0回答:1

我正在尝试发送“Hello Word!”在python3.5中使用telnetlib到localhost。我的代码:

import telnetlib

HOST = "127.0.0.1"

tn = telnetlib.Telnet(HOST, 135) # host, port, timeout

tn.write("Hello World!".encode('ascii'))

我已经在我的Windows 10中启用了telnet。我去了cmd并运行:

telnet localhost 135

然后我得到一个空白的屏幕:enter image description here

之后我运行了我的代码,它只是在0.3秒完成。终端没有输出。它只是留空。为什么没有“Hello World!”登上telnet cmd?怎么了?我是新来的。

编辑:

刚试过netcat客户端。仍然无法正常工作。

enter image description here

python python-3.x localhost telnet telnetlib
1个回答
0
投票

听起来你在Windows 10中启用了telnet客户端应用程序,命令telnet localhost 135尝试连接到在localhost端口135上运行的已经运行的telnet服务器。没有输出,因为我猜它没有成功连接到任何东西。

您很可能需要一个telnet服务器,由于非常不安全,它似乎已从最新版本的Windows中弃用。 Microsoft建议使用远程桌面替换telnet

© www.soinside.com 2019 - 2024. All rights reserved.