1Socket::GetAddrInfo::EmUusle(r3pCmo)ntributed Perl DocumSeonctkaetti:o:nGetAddrInfo::Emul(3pm)
2
3
4
6 "Socket::GetAddrInfo::Emul" - Pure Perl emulation of "getaddrinfo" and
7 "getnameinfo" using IPv4-only legacy resolvers
8
10 "Socket::GetAddrInfo" attempts to provide the "getaddrinfo" and
11 "getnameinfo" functions by some XS code that calls the real functions
12 in libc. If for some reason this cannot be done; either there is no C
13 compiler, or libc does not provide these functions, then they will be
14 emulated using the legacy resolvers "gethostbyname", etc... These
15 emulations are not a complete replacement of the real functions,
16 because they only support IPv4 (the "AF_INET" socket family). In this
17 case, the following restrictions will apply.
18
19 getaddrinfo
20 • If the "family" hint is supplied, it must be "AF_INET". Any other
21 value will result in an error thrown by "croak".
22
23 • The only supported "flags" hint values are "AI_PASSIVE",
24 "AI_CANONNAME", "AI_NUMERICSERV" and "AI_NUMERICHOST".
25
26 The flags "AI_V4MAPPED" and "AI_ALL" are recognised but ignored, as
27 they do not apply to "AF_INET" lookups. Since this function only
28 returns "AF_INET" addresses, it does not need to probe the system
29 for configured addresses in other families, so the "AI_ADDRCONFIG"
30 flag is also ignored.
31
32 Note that "AI_NUMERICSERV" is an extension not defined by RFC 2553,
33 but is provided by most OSes. It is possible (though unlikely) that
34 even the native XS implementation does not recognise this constant.
35
36 getnameinfo
37 • If the sockaddr family of $addr is anything other than "AF_INET",
38 an error will be thrown with "croak".
39
40 • The only supported $flags values are "NI_NUMERICHOST",
41 "NI_NUMERICSERV", "NI_NOFQDN", "NI_NAMEREQD" and "NI_DGRAM".
42
44 This pure-perl emulation provides the IDN constants such as "AI_IDN"
45 and "NI_IDN", but the "getaddrinfo" and "getnameinfo" functions will
46 croak if passed these flags. This should allow a program to probe for
47 their support, and fall back to some other behaviour instead.
48
50 Paul Evans <leonerd@leonerd.org.uk>
51
52
53
54perl v5.38.0 2023-07-21 Socket::GetAddrInfo::Emul(3pm)