%SS_GETADDRINFO

Get the IPv4 address corresponding to a host name

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %SS_GETADDRINFO(h_name, in_addr)

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

h_name

Specifies the host name. (a)

in_addr

Returned with the IPv4 address(es). ([*]i4)

Discussion

%SS_GETADDRINFO retrieves an IPv4 address using the host name in h_name as a search parameter. When in_addr is an array, the array is filled with all of the IP addresses associated with the host name up to the number of elements in the array. Any array element in excess of the number needed for the available IP addresses is filled with a zero value.

Tip

If you do not know the number of addresses to be returned, you may want to use %SS2_GETADDRINFO instead. It uses a dynamic array of bytes to return addresses, and can be used with both IPv4 and IPv6 addresses.

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

Note

Do not use %SS_GETADDRINFO to resolve dotted IP address strings—it should be used only when the known value is the host name. To resolve an IP address string, use %SS_INET_ADDR to convert the string to a numeric IP address. If you want to get the host name, you can then use %SS_GETNAMEINFO to retrieve that value.