in reply to Re: X or console?
in thread X or console?
What is your port_not_listening()? here's mine:
sub port_not_listening { # UNTESTED my $timeout = 10; my ($remote, $port) = split(/:/, $_[0]); $iaddr = inet_aton($remote) or return 1; $paddr = sockaddr_in($port, $iaddr); $proto = getprotobyname('tcp'); # X uses tcp, right? socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!"; eval { local $SIG{ALRM} = sub { die "connection timeout\n" }; alarm $timeout; connect(SOCK, $paddr) or die "$! for $remote\n"; alarm 0; }; return 1 if ( $@ ); return 0; }
Update: Halley points out correctly (below) that the line my ($remote, $port) = split(/:/, $_[0]); is unlikely to actually yield a correct port number.
--Bob Niederman, http://bob-n.com
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: X or console?
by halley (Prior) on Jul 23, 2003 at 19:09 UTC | |
by bobn (Chaplain) on Jul 23, 2003 at 23:51 UTC |