sethostid()--Set Host ID


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

 int sethostid(int host_id)

  Service Program Name: QSOSRV1

  Default Public Authority: *USE

  Threadsafe: Yes

The sethostid() function is used to set a host ID.


Parameters

host_id
(Input) The 32-bit host_id

Authorities

No authorization is required.


Return Value

sethostid() returns an integer. Possible values are:


Error Conditions

When sethostid() fails, errno can be set to one of the following:



Error Messages



Usage Notes

  1. A process must have the *iosyscfg special authority to use the sethostid().

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

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

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

  5. The host_id is a signed integer. Therefore, a user should be careful to not confuse a return value of -1 from a gethostid() with an error return value. gethostid() never returns an error.

Related Information

gethostid()--Retrieve Host ID Address



API introduced: V3R1

[ Back to top | UNIX-Type APIs | APIs by category ]