%SS_GETNAMEINFO

Get the host name corresponding to an IPv4 address

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %SS_GETNAMEINFO(in_addr, 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_addr

Specifies an IPv4 address. (i4)

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

%SS_GETNAMEINFO retrieves a host name using the host address in_addr as a search parameter.

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_addr 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.