in reply to IO::Socket:INET doesn't attempt to connect

This statement:

my $socket = IO::Socket::INET->new(%socket) or die $!;
doesn't do what you want. &IO::Socket::INET::new does not work with or die $!. It returns a (true) reference to a Symbol whether or not the socket's connection was established. You may want to check defined( $socket->connected()), inherited from IO::Socket.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: IO::Socket:INET doesn't attempt to connect
by BrowserUk (Patriarch) on Apr 24, 2003 at 06:01 UTC

    Thanks Zaxo. In my defense, the 5.8 IO::Socket::INET pod contains this example:

    $sock = IO::Socket::INET->new(PeerPort => 9999, PeerAddr => inet_ntoa(INADDR_BROADCA +ST), Proto => udp, LocalAddr => 'localhost', Broadcast => 1 ) or die "Can't bind : $@\n";

    Examine what is said, not who speaks.
    1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
    2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
    3) Any sufficiently advanced technology is indistinguishable from magic.
    Arthur C. Clarke.