gethostid()--Retrieve Host ID Address



Syntax

#include <sys/types.h>
#include <sys/socket.h>

int gethostid()


Threadsafe: Yes

The gethostid() function is used to retrieve a host ID's 32-bit IP address.

Return Value

gethostid() returns an integer. Possible values are:

Usage Notes

  1. When a process issues a sethostid(), the host_id can be accessed by any process that issues a gethostid()

  2. The host_id is reset to zero when an initial program load is performed.

  3. The host_id is a signed integer. Therefore, a -1 return value from the gethostid() may not indicate an error, but rather that a previous sethostid() was issued that specified a host_id of -1.

  4. While many socket implementations refer to the host_id as the IP address of the machine, this is not necessarily the case. Many machines that support the TCP/IP protocol suite support multiple local IP addresses. The value contained in host_id is not used by TCP in any manner.

Related Information


Top | Sockets APIs | APIs by category


[Information Center Home Page | Feedback ] [Legal | AS/400 Glossary]