Can anyone explain to me why the output of the script called within this
script prints the output to the screen and not to the client connected
to the socket.
Many thanks
#!/usr/local/bin/perl -w
use Socket;
if (!@ARGV) {
print "Script cannot be called with no Port Number.... doh!\n";
} else {
$server_port = $ARGV[0];
socket(SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1);
$my_addr = sockaddr_in($server_port, INADDR_ANY);
bind(SERVER, $my_addr) or die "couldnt bind";
listen(SERVER, SOMAXCONN) or die "cant listen";
while (accept(CLIENT, SERVER)) {
*STDOUT = *CLIENT;
$input = <CLIENT>;
chomp $input;
chop $input;
system ("./scottscript $input");
#open (OUTSTUFF, ">checkdis");
#print OUTSTUFF $input;
#close OUTSTUFF;
}
close(SERVER);
}
Regards,
Scott L Ryan
OneTel.Net ISP Engineer