Switch branches/tags
libwww-perl/6.03 libwww-perl/6.02 libwww-perl/6.01 libwww-perl/6.00 libwww-perl/5.837 libwww-perl/5.836 libwww-perl/5.835 libwww-perl/5.834 libwww-perl/5.833 libwww-perl/5.832 libwww-perl/5.831 libwww-perl/5.830 libwww-perl/5.829 libwww-perl/5.828 libwww-perl/5.827 libwww-perl/5.826 libwww-perl/5.825 libwww-perl/5.824 libwww-perl/5.823 libwww-perl/5.822 libwww-perl/5.821 libwww-perl/5.820 libwww-perl/5.819 libwww-perl/5.818 libwww-perl/5.817 libwww-perl/5.816 libwww-perl/5.815 libwww-perl/5.814 libwww-perl/5.813 libwww-perl/5.812 libwww-perl/5.811 libwww-perl/5.810 libwww-perl/5.808 libwww-perl/5.807 libwww-perl/5.806 libwww-perl/5.805 libwww-perl/5.804 libwww-perl/5.803 libwww-perl/5.802 libwww-perl/5.801 libwww-perl/5.800 libwww-perl/5.79 libwww-perl/5.78 libwww-perl/5.77 libwww-perl/5.76 libwww-perl/5.75 libwww-perl/5.74 libwww-perl/5.73 libwww-perl/5.72 libwww-perl/5.71 libwww-perl/5.70 libwww-perl/5.69 libwww-perl/5.68 libwww-perl/5.67 libwww-perl/5.66 libwww-perl/5.65 libwww-perl/5.64 libwww-perl/5.63 libwww-perl/5.62 libwww-perl/5.61 libwww-perl/5.60 libwww-perl/5.53.97 libwww-perl/5.53.96 libwww-perl/5.53.95 libwww-perl/5.53.94 libwww-perl/5.53.93 libwww-perl/5.53.92 libwww-perl/5.53.91 libwww-perl/5.53.90 libwww-perl/5.53 libwww-perl/5.52 libwww-perl/5.51 libwww-perl/5.50 libwww-perl/5.49 libwww-perl/5.48 libwww-perl/5.47 libwww-perl/5.46 libwww-perl/5.45 libwww-perl/5.44 libwww-perl/5.43 libwww-perl/5.42 libwww-perl/5.41 libwww-perl/5.40.01 libwww-perl/5.36 libwww-perl/5.35 libwww-perl/5.34 libwww-perl/5.33 libwww-perl/5.32 libwww-perl/5.31 libwww-perl/5.30 libwww-perl/5.22 libwww-perl/5.21 libwww-perl/5.20 libwww-perl/5.19 libwww-perl/5.18.05 libwww-perl/5.18.04 libwww-perl/5.18.03 libwww-perl/5.18 libwww-perl/5.17 libwww-perl/5.16
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (43 sloc) 1.37 KB
#!perl -w
# This program check if we are able to talk to ourself. Misconfigured
# systems that can't talk to their own 'hostname' was the most commonly
# reported libwww-failure.
use strict;
require IO::Socket;
if (@ARGV >= 2 && $ARGV[0] eq "--port") {
my $port = $ARGV[1];
require Sys::Hostname;
my $host = Sys::Hostname::hostname();
if (my $socket = IO::Socket::INET->new(PeerAddr => "$host:$port", Timeout => 5)) {
require IO::Select;
if (IO::Select->new($socket)->can_read(1)) {
my($n, $buf);
if ($n = sysread($socket, $buf, 512)) {
exit if $buf eq "Hi there!\n";
die "Seems to be talking to the wrong server at $host:$port, got \"$buf\"\n";
elsif (defined $n) {
die "Immediate EOF from server at $host:$port\n";
else {
die "Can't read from server at $host:$port: $!";
die "No response from server at $host:$port\n";
die "Can't connect: $@\n";
# server code
my $socket = IO::Socket::INET->new(Listen => 1, Timeout => 5);
my $port = $socket->sockport;
open(CLIENT, qq("$^X" "$0" --port $port |)) || die "Can't run $^X $0: $!\n";
if (my $client = $socket->accept) {
print $client "Hi there!\n";
close($client) || die "Can't close socket: $!";
else {
warn "Test server timeout\n";
exit if close(CLIENT);
die "Can't wait for client: $!" if $!;
die "The can-we-talk-to-ourself test failed.\n";