Related functions
The following macros and
socket functions provide the additional functionality required
to write ``IPv6 ready'' applications.
-
The IN6_IS_ADDR_V4MAPPED macro, described on the
inet(S)
manual page, can be used to
determine whether an
IPv6 address is an IPv4-mapped address.
-
gethostbyname2(S)
retrieves a network host entry via its name and address family.
-
getaddrinfo(S)
returns address information related to a specified service location.
-
getnameinfo(S)
returns the text strings associated with the supplied IP address and port number.
-
inet_pton(S)
converts the specified address in text form to its binary equivalent.
-
inet_ntop(S)
converts the specified binary address into its text equivalent suitable for presentation.
getaddrinfo and getnameinfo can both be used to
retrieve information related to IPv4 and IPv6
addresses. inet_pton and inet_ntop can both convert
IPv4 and IPv6 addresses. This means that in
``IPv6 ready'' applications, you do not need to use either
inet_addr or inet_ntoa.
In addition to the new functions listed above, the following sockets
functions have been modified.
-
bind(S)
-
connect(S)
-
sendmsg(S)
-
sendto(S)
-
accept(S)
-
recvfrom(S)
-
recvmsg(S)
-
getpeername(S)
-
getsockname(S)
No change in the syntax of these functions is necessary
when using them for IPv6,
as all addresses are referenced by ``opaque'' address pointers.
The only difference when using these functions is that you must cast
sockaddr_in6 to struct sockaddr* when using any of these
functions except sendmsg and recvmsg. When you use
these functions, set the structure member msghdr.msg_name
to point to your sockaddr_in6 structure and store the length
of the structure in msghdr.msg_namelen
.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005