10 PF_INET SOCK_STREAM IPPROTO_TCP pack_sockaddr_in INADDR_ANY
11 AI_PASSIVE AI_NUMERICSERV
14 my $AI_ADDRCONFIG = eval { Socket::AI_ADDRCONFIG() } || 0;
20 no warnings 'redefine';
22 *{"IO::Socket::IP::getaddrinfo"} = sub {
23 push @gai_args, [ @_ ];
24 return @{ shift @gai_rets };
31 socktype => SOCK_STREAM,
32 protocol => IPPROTO_TCP,
33 addr => pack_sockaddr_in( 80, INADDR_ANY )
36 IO::Socket::IP->new( LocalPort => "80" );
38 is_deeply( \@gai_args,
40 [ undef, "80", { flags => AI_PASSIVE|$AI_ADDRCONFIG, socktype => SOCK_STREAM, protocol => IPPROTO_TCP } ],
42 '@gai_args for LocalPort => "80"' );
45 skip "No AI_NUMERICSERV", 1 unless defined eval { AI_NUMERICSERV() };
51 socktype => SOCK_STREAM,
52 protocol => IPPROTO_TCP,
53 addr => pack_sockaddr_in( 80, INADDR_ANY )
56 IO::Socket::IP->new( LocalPort => "80", GetAddrInfoFlags => AI_NUMERICSERV );
58 is_deeply( \@gai_args,
60 [ undef, "80", { flags => AI_PASSIVE|AI_NUMERICSERV, socktype => SOCK_STREAM, protocol => IPPROTO_TCP } ],
62 '@gai_args for LocalPort => "80", GetAddrInfoFlags => AI_NUMERICSERV' );