4 unless(grep /blib/, @INC) {
6 unshift @INC, '../lib' if -d '../lib';
13 if(-d "lib" && -f "TEST") {
16 if ($Config{'extensions'} !~ /\bSocket\b/) {
17 $reason = 'Socket was not built';
19 elsif ($Config{'extensions'} !~ /\bIO\b/) {
20 $reason = 'IO was not built';
22 elsif ($^O eq 'os2') {
23 $reason = "blocks on OS/2, not debugged yet";
25 elsif ($^O eq 'apollo') {
26 $reason = "unknown *FIXME*";
28 undef $reason if $^O eq 'VMS' and $Config{d_socket};
30 print "1..0 # Skip: $reason\n";
39 my @a = unpack_sockaddr_in($a);
40 my @b = unpack_sockaddr_in($b);
41 "$a[0]$a[1]" eq "$b[0]$b[1]";
48 use IO::Socket qw(AF_INET SOCK_DGRAM INADDR_ANY);
50 # This can fail if localhost is undefined or the
51 # special 'loopback' address 127.0.0.1 is not configured
52 # on your system. (/etc/rc.config.d/netconfig on HP-UX.)
53 # As a shortcut (not recommended) you could change 'localhost'
54 # here to be the name of this machine eg 'myhost.mycompany.com'.
56 $udpa = IO::Socket::INET->new(Proto => 'udp', LocalAddr => 'localhost')
57 or die "$! (maybe your system does not have the 'localhost' address defined)";
61 $udpb = IO::Socket::INET->new(Proto => 'udp', LocalAddr => 'localhost')
62 or die "$! (maybe your system does not have the 'localhost' address defined)";
66 $udpa->send("ok 4\n",0,$udpb->sockname);
68 print "not " unless compare_addr($udpa->peername,$udpb->sockname);
71 my $where = $udpb->recv($buf="",5);
76 unless(compare_addr($where,$udpa->sockname)) {
78 @xtra = (0,$udpa->sockname);
82 $udpb->send("ok 6\n",@xtra);
83 $udpa->recv($buf="",5);
86 print "not " if $udpa->connected;