in reply to Seeking IO::Socket Advice
You might want to spend some time reading the man page on IO::Socket::INET
Perl provides a WONDERFUL built in variable $! that is kind of a combination of errno and strerror. You can check the result of your connection with this variable in addition to getting an undef back to clarify WHY it didn't connect:
use Errno ; # for ECONNREFUSED use IO::Socket::INET ; # portions copies from the IO::Socket::INET man page: $sock = IO::Socket::INET->new(PeerAddr => 'www.perl.org', PeerPort => 'http(80)', Proto => 'tcp'); if( $sock == undef && $! == ECONNREFUSED ) { # server not operating? }
|
|---|