J
joe rockhead
I found IO::All on CPAN.org
It includes some descriptions on accepting connections on a socket.
here's what I did with their examples:
#!/usr/bin/perl
use IO::All;
use Perl6::Say;
say "point A";
$server = io('10.0.0.123:12345')->fork; # Create a daemon socket
say "point B \$server = [$server]";
$connection = $server->accept; # Get a connection socket
say "point C \$connection = [$connection]";
$input < $connection; # Get some data from it
say "point D \$input = [$input]";
"Thank you!" > $connection; # Thank the caller
say "point E \$connection = [$connection]";
$connection->close; # Hang up
say "point F";
#io(':6666')->accept->slurp > io->devnull; # Take a complaint and file it
say "point G";
running the program, I get up to point B.
when a connection is made from a remote machine, I get up to point C
then it just seems to hang there no matter what the remote machine does.
the remote session seems to just hang also.
when the remote machine disconnects, I get "Can't open socket" error on the server side.
right now I just want to be able to accept input and perhaps print something out.
It includes some descriptions on accepting connections on a socket.
here's what I did with their examples:
#!/usr/bin/perl
use IO::All;
use Perl6::Say;
say "point A";
$server = io('10.0.0.123:12345')->fork; # Create a daemon socket
say "point B \$server = [$server]";
$connection = $server->accept; # Get a connection socket
say "point C \$connection = [$connection]";
$input < $connection; # Get some data from it
say "point D \$input = [$input]";
"Thank you!" > $connection; # Thank the caller
say "point E \$connection = [$connection]";
$connection->close; # Hang up
say "point F";
#io(':6666')->accept->slurp > io->devnull; # Take a complaint and file it
say "point G";
running the program, I get up to point B.
when a connection is made from a remote machine, I get up to point C
then it just seems to hang there no matter what the remote machine does.
the remote session seems to just hang also.
when the remote machine disconnects, I get "Can't open socket" error on the server side.
right now I just want to be able to accept input and perhaps print something out.