7stud has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I get a "Connection refused" error from this code:
use strict; use warnings; use 5.010; use IO::Socket; my $host = 'localhost'; my $port = 'daytime(13)'; #Error on this line: my $sock = IO::Socket::INET->new( Proto => 'tcp', PeerHost => $host, PeerPort => $port, ) or die "cannot connect: $!"; while (<$sock>) { print; }
I've found several examples of code on google that use localhost as the host, but it doesn't seem to work for me. I'm using mac osx 10.4.11.
I can't seem to find a public daytime server either.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sockets: problems with daytime client
by gmargo (Hermit) on Jan 20, 2010 at 15:53 UTC | |
by 7stud (Deacon) on Jan 24, 2010 at 12:01 UTC | |
by Anonymous Monk on Jan 24, 2010 at 12:31 UTC | |
|
Re: sockets: problems with daytime client
by zentara (Cardinal) on Jan 20, 2010 at 12:27 UTC | |
|
Re: sockets: problems with daytime client
by Anonymous Monk on Jan 20, 2010 at 09:35 UTC | |
by 7stud (Deacon) on Jan 20, 2010 at 10:01 UTC | |
by broomduster (Priest) on Jan 20, 2010 at 12:54 UTC | |
by Anonymous Monk on Jan 20, 2010 at 10:58 UTC |