gethostid()--Retrieve Host ID


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

 int gethostid()

  Service Program Name: QSOSRV1

  Default Public Authority: *USE

 nbsp;Threadsafe: Yes

The gethostid() function is used to retrieve a host's ID.


Authorities

No authorization is required.


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



API introduced: V3R1
Top | UNIX-Type APIs | APIs by category