1

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!

mob
  • 117,087
  • 18
  • 149
  • 283
dellair
  • 427
  • 4
  • 22
  • 2
    Let's forget about that script, **what are you actually trying to do?** (Also, the readline operator can return `undef` when the end of the stream is reached. If the STDIN is closed, this is to be expected. Closing STDIN kind of makes sense for a service/daemon. Just using `IO::Socket` doesn't magically make your script a telnet server). – amon Jun 16 '13 at 14:58
  • @amon, no, but inetd does. – ikegami Jun 16 '13 at 16:26

1 Answers1

1

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.

dellair
  • 427
  • 4
  • 22