如何为应用程序创建 Telnet 接口
我在 Linux 平台上遇到过一些通过 telnet 管理的专有应用程序。远程 telnet 未启用,但您在主机上执行 telnet 会话。您将获得一个界面,您可以在其中输入命令以使应用程序运行。我想知道如何为任何特定应用程序构建 telnet 接口。不寻找分步说明,只是寻找如何为应用程序构建 telnet 接口的基本/一般/全局答案。
I have come across a couple of proprietary applications on Linux platform which are administered via telnet. Remote telnet is not enabled but on the host you do a telnet session. You get an interface where you enter commands to make the application work. I was wondering how a telnet interface is built for any particular application. Not looking for a step-by-step, just a basic/general/big-picture answer of how one can approach building a telnet interface for an application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
telnet 基于 TCP/IP 协议。要从 C 程序“执行”telnet,您需要开始处理套接字、
accept()
-ing 连接并使用fork()
-d 读取和写入它们线程(非常简单)。如果应用程序已经存在,并且已经通过 stdin/stdout 与控制台通信,您可以使用 (a) Internet 守护程序中的某些配置 (x)
inetd
,在其上安装 telnet 接口,或者滥用 TCP/IP 的瑞士军刀netcat
。这两个程序的文档模糊地描述了如何设置。如果您需要更多帮助,您知道在哪里寻求帮助!
telnet is based on the TCP/IP protocol. To "do" telnet from a C program, you'd start messing with sockets,
accept()
-ing connections and reading and writing to them usingfork()
-d threads (that's VERY briefly it).If the app is already there, and already communicates to the console via stdin/stdout, you can rig a telnet interface on to it using (a) some configuration in your Internet daemon, (x)
inetd
, or by misusing the Swiss Army knife of TCP/IP,netcat
.The docs for both those programs describe how to set things up, vaguely. If you need more help, you know where to ask!