On Thursday, March 14, 2002, at 12:49  PM, bob ackerman wrote:

> perlipc doc has sample for doing a socket:
>
> use IO::Socket;
> $remote = IO::Socket::INET->new(
>                                  Proto    => "tcp",
>                                  PeerAddr => "localhost",
>                                  PeerPort => "daytime(13)",
>                          )
>                        or die "cannot connect to daytime port at localhost";
> while ( <$remote> ) { print }
>
> but it dies for me.
> i see 'daytime' in /etc/services at port 13.
> osx 10.1.3
> perl 5.6.1

Something I've done before, after a fashion.

You might try inserting a more useful error message, something like:

die "IO::Socket::INET $!" unless $remote;

which will likely inform you that localhost is refusing your 
connection on port 13. Don't ask me why (yet), it's not 
important at the moment. Find a remote host whose owner doesn't 
mind you connecting to daytime and try it that way.

also try:

while (defined (<$remote>))

--B

--
"If you actually thought flattery would turn on your Mac, you should
probably read 'Self-Psychotherapy for Dummies' before you continue
with this book. (And if you think that book exists, maybe you 
should check
out 'Gullibility for  Dummies')."   --- Bob Levitus in "MacOS X 
for Dummies"

Reply via email to