windowsperlstdininetd

Perl reading STDIN via inetd on windows error "Bad file descriptor"


I have inetd configured via Cygwin on Windows and started as service.

The script:

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";

On command line:

telnet localhost <port>

It fails immediately with:

(Failed reading STDIN) The parameter is incorrect (Error) Bad file descriptor (End)

I have been searching for the whole google but couldn't find solution. Could anyone shed some lights on it?

Appreciated!


Update: Thanks for the replies, I know that IO::Socket doesn't make a Telent server, but by setting up cygwin inetd, it becomes one. Telnet to the port Works and the script in inetd.conf is invoked. Also the STDOUT works. Only thing that is not working is STDIN. I have a tool for people to submit commands, the tool sends the coomands to inetd server via the port as STDIN. The same mechanism works on all unix like platform, solaris, hp, linux, aix. Just not on windows...

One thing I don't understand is, why STDIN is closed, do we have some way to debug? Thanks in advance!


Solution

  • It seems to be a bug with Cygwin & invoking Perl from ClearCase VOB. For future reference: I compiled perl in Cygwin and invoked it from the inetd script. Things are working fine as far as I can tell.