Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my $socket; my $line; my $child_pid; $socket = IO::Socket::INET->new ( PeerAddr => 'server.com', PeerPort => 1247, Proto => "tcp", Type => SOCK_STREAM ) or die "Could not create client.\n"; unless (defined($child_pid = fork())) {die "Cannot fork.\n"}; if ($child_pid) { while($line = <>) { print $socket $line; } } else { while ($line = <$socket>) { print "Other side: $line"; } } # never reach here -- WHY NOT?
Edit kudra, 2002-04-23 Changed title
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Seeking explanation of IO::Socket behaviour
by dws (Chancellor) on Apr 22, 2002 at 02:44 UTC | |
by graff (Chancellor) on Apr 22, 2002 at 03:08 UTC | |
by Anonymous Monk on Apr 22, 2002 at 03:28 UTC | |
by Anonymous Monk on Apr 22, 2002 at 03:27 UTC |