On Mon, 03 Mar 2003 09:59:01 -0700, [EMAIL PROTECTED] wrote:
>Is there an issue running perl under linux xinetd where xinetd is
>listening for connections on a UDP port and then forking the following
>perl code. When I do this, the perl code does not see any input on
>STDIN. How does one get at the data received on the socket
>by xinetd?
>while (<STDIN>) {
> $input = $_;
> syslog('info', "Read : $input") ;
> }
I see 2 possible problems, 1 is the /etc/xinetd.conf setup,
and the other is buffering.
I have your example running by doing the following:
In /etc/xinetd.conf:
##########################################3
# test scripts, choose an unused port
# name the service something
# add protocol,port, and server
service xtest
{
socket_type = stream
protocol = tcp
port = 8085
flags = REUSE
wait = no
instances = UNLIMITED
user = root
server = /usr/local/bin/xtest
}
#############################################
/usr/local/bin/xtest (chmod 755)
##############################################
#!/usr/bin/perl
use Sys::Syslog;
syslog('info', "Started: time()") ;
select (STDOUT);$|++;
print "Start typing\r\n";
select (STDIN);$|++;
while (<STDIN>) {
$input = $_;
syslog('info', "Read : $input") ;
}
###############################################
Then "telnet 127.0.0.1 8085"; you need to hit the telnet escape
^] then type quit to exit.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]