%SS2_GETNAMEINFO

Get the host name corresponding to an IP address

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %SS2_GETNAMEINFO(in_addr6, h_name[, flag])

Return value

status

If successful, returns SS_SUCCESS (0). If unsuccessful, returns SS_ENULL (2). See the Socket Errors table for additional information about this error. (n)

Arguments

in_addr6

Specifies an IPv4 or IPv6 address. ([#]byte)

h_name

Returned with the host name. (a)

flag

(optional) Specifies the behavior: (i4)

NI_NUMERICHOST

Returns h_name in numeric form (but note that it will still be an alpha).

NI_NOFQDN

Returns only the host name portion of the fully-qualified domain name.

NI_NAMEREQD

Returns SS_ENULL as status if the host name cannot be determined.

Discussion

%SS2_GETNAMEINFO retrieves a host name using the host address in_addr6 as a search parameter. It supports both IPv4 and IPv6 formatted addresses.

The form of h_name depends on the system implementation (and on whether you pass NI_NOFQDN). For example, it may return a simple host name such as socrates or a fully-qualified domain name such as socrates.synergex.com. If you pass the NI_NOFQDN flag, it will return only the simple host name, even if the domain name is available.

If h_name cannot be determined, the numeric form of in_addr6 is returned, unless you have specified NI_NAMEREQD, in which case SS_ENULL will be returned.

If SS_ENULL is returned, the system error code can be returned by immediately calling %SYSERR.