sethostid()--Set Host ID Address


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

int sethostid(int host_id)


Threadsafe: Yes

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

Parameters

host_id
(Input) The 32-bit host_id

Return Value

sethostid() returns an integer. Possible values are:

Error Conditions

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

[EIO]
Input/output error.
[EPERM]
Operation not permitted.

The process does not have the appropriate privileges to use sethostid().

[EUNKNOWN]
Unknown system state.

Error Messages

CPE3418 E
Possible APAR condition or hardware failure.
CPF9872 E
Program or service program &1 in library &2 ended. Reason code &3.
CPFA081 E
Unable to set return value or error code.

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


Top | Sockets APIs | APIs by category


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