Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Converts a socket address to a string describing the host and another string describing the service.

Files

net_bsd.h/net_bsd.c

Prototype

Code Block
int  getnameinfo (const  struct  sockaddr  *p_sockaddr,
                                 int        addrlen,
                                 char      *p_host_name,
                                 int        hostlen,
                                 char      *p_service_name,
                                 int        servicelen,
                                 int        flags)

Arguments

p_sockaddr

    Pointer to the sockaddr structure with the protocol address to be converted.

...

    Flags that change how this function converts the socket address.

  •     NI_NAMEREQD
  •     NI_DGRAM
  •     NI_NOFQDN
  •     NI_NUMERICHOST
  •     NI_NUMERICSERV-  an EAI_NONAME error will be returned if the host name cannot be resolved.
  • NI_DGRAM - the resolved service name will be the name of the UDP service used by that port. Some ports are shared between TCP and UDP.
  • NI_NOFQDN - the resolved host name will be truncated until the first '.' character.
  • NI_NUMERICHOST - 'p_host_name' will be resolved to the string representation of the IP address in dotted form.
  • NI_NUMERICSERV - 'p_service_name' will be resolved to the string representation of numeric value of the service port.

Returned Value

0, if no error.

...