我在 Windows 上通过 Cygwin 配置了 inetd 并作为服务启动。
剧本:
use strict;
use warnings;
use IO::Socket;
use IO::Handle;
use IO::File;
use IO::Select;
print "input something\n";
STDOUT-> autoflush (1);
my $data = <STDIN> || die "(Failed reading STDIN) $^E (Error) $! (End)\n";
在命令行上:
telnet localhost <port>
它立即失败:
(Failed reading STDIN) The parameter is incorrect (Error) Bad file descriptor (End)
我一直在搜索整个谷歌,但找不到解决方案。有人可以解释一下吗?
赞赏!
更新: 感谢您的回复,我知道 IO::Socket 不会创建 Telent 服务器,但是通过设置 cygwin inetd,它就变成了一个。Telnet 到端口 Works 并调用 inetd.conf 中的脚本。STDOUT 也有效。唯一不起作用的是标准输入。我有一个供人们提交命令的工具,该工具通过端口作为 STDIN 将 coomands 发送到 inetd 服务器。相同的机制适用于所有 unix,如 platform、solaris、hp、linux、aix。只是不在窗户上...
我不明白的一件事是,为什么 STDIN 是关闭的,我们有什么方法可以调试吗?提前致谢!