in reply to Re^2: IO::Socket *always* making connection?
in thread IO::Socket *always* making connection?

I don't see where your problem is. The following script works fine for me. My box has an smpt server listening on port 25, a pop3 server on port 110, and nothing on ports 9805 and 9806. The results are as expected.

#!/usr/bin/perl -w use strict; use IO::Socket; for my $port (25, 9805, 9806, 110) { my $skipA = 0; my $socketA = new IO::Socket::INET( PeerAddr => 'localhost', PeerPort => $port, Proto => 'tcp', ) or $skipA = 1; print "\$port: $port; \$skipA: $skipA\n"; } __END__ $port: 25; $skipA: 0 $port: 9805; $skipA: 1 $port: 9806; $skipA: 1 $port: 110; $skipA: 0

Replies are listed 'Best First'.
Re^4: IO::Socket *always* making connection?
by wolfger (Deacon) on Feb 08, 2005 at 19:12 UTC

    The problem comes not when there is nothing there (i.e. 9805/9806), but when there *is* something there, but it's busy. My program fails to retrieve any data, and also fails to say "sorry, couldn't connect, he's busy".


    --
    Linux, sci-fi, and Nat Torkington, all at Penguicon 3.0
    perl -e 'print(map(chr,(0x4a,0x41,0x50,0x48,0xa)))'
A reply falls below the community's threshold of quality. You may see it by logging in.