Functions and Directives

Function SocketGetHostByAddr() Professional

Retrieves host information using an IP address.

SocketGetHostByAddr( <cIPAddr>|<nIPAddr>, ;
                     [@<nError>]          ) --> aHostInfo|NIL
The IP address of a host can be specified as a character string using dottet octet notation ("").
Alternatively, a numeric value can be passed for the first parameter. It is the numeric IP address in network byte order.
If this parameter is passed by reference to the function, it gets assigned a numeric error code when the function fails. #define constants beginning with WSAE are available in the file SOCKET.CH to identify an error condition.

The function returns an array containing host information, or NIL on failure. The following #define constants are available in the file SOCKET.CH to access the individual elements of the host array:

Constants for the host array
Constant Description
HOSTINFO_CNAME Character string containing the host name
HOSTINFO_ALIAS One-dimensional array holding the alias names of the host. If no alias names exist, the array is empty.
HOSTINFO_NTYPE Numeric value indicating address family. (always AF_INET for Windows sockets)
HOSTINFO_NLEN Number of bytes required to encode the numeric IP address.
HOSTINFO_ADDR One-dimensional array holding the numeric IP addresses of the host in network byte order.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.