Hi all,
I am using IPC::Open2. I have a Read Handle (RH) and a Write Handle (WH). I fork() for doing non-blocking IO.
my problem is , when i try the print the RH to socket ($client), It writes to STDOUT (server console screen). nothing gets written to the socket.
Thanks in advance for any help on this.
Regards,
Jeremy Aiyadurai.
The following is the code. ----------------------------------------------------------------------------------------
$server = IO::Socket::INET->new( Proto => 'tcp', LocalPort => $PORT, Listen => SOMAXCONN, Reuse => 1);
die "can't setup server" unless $server; print "[Server $0 accepting clients]\n"; #while(1) #{
while ($client = $server->accept()) {
$client->autoflush(1);
my $LFLAG = 0;
my $UP;
$hostinfo = gethostbyaddr($client,$client->peeraddr);
my $cmd = <$client>;
open2(\*RH,\*WH,"$cmd");
die "can't fork: $!" unless defined($kidpid = fork());
if ($kidpid) {
my $byte;
while (defined(my $byte = <$client>)) {
print WH $byte;
}
#kill("TERM", $kidpid);
}
else {
my $l;
while ((defined ($l = <RH>))) { <- problem here, RH does not write to client, it writes to STDOUT.
print $client $l;
}
}
}
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs