ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/ghosti.htm

129 lines
3.4 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>gethostid()--Retrieve Host ID</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- Edited by Kersten Feb 02 -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!--End Header Records -->
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>gethostid()--Retrieve Host ID</h2>
<div class="box" style="width: 80%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
int gethostid()
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QSOSRV1<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <em>gethostid()</em> function is used to retrieve a host's ID.</p>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<p><em>gethostid()</em> returns an integer. Possible values are:</p>
<ul>
<li>0 when a <em>sethostid()</em> has not been issued previously since the last
initial program load (IPL)<br>
<br>
</li>
<li>n (successful), where n is the number specified on a previously issued
<em>sethostid()</em> call</li>
</ul>
<br>
<h3>Usage Notes</h3>
<ol>
<li>When a process issues a <em>sethostid()</em>, the <em>host_id</em> can be
accessed by any process that issues a <em>gethostid()</em><br>
<br>
</li>
<li>The <em>host_id</em> is reset to zero when an initial program load is
performed.<br>
<br>
</li>
<li>The <em>host_id</em> is a signed integer. Therefore, a -1 return value from
the <em>gethostid()</em> may not indicate an error, but rather that a previous
<em>sethostid()</em> was issued that specified a <em>host_id</em> of -1.<br>
<br>
</li>
<li>While many socket implementations refer to the <em>host_id</em> 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 <em>host_id</em> is <strong>not</strong> used by TCP in any
manner.</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="shosti.htm">sethostid()</a>--Set Host ID Address<br>
<br>
</li>
<li><a href="ghostn.htm">gethostname()</a>--Retrieve Host Name<br>
<br>
</li>
<li><a href="shostn.htm">sethostname()</a>--Set Host Name</li>
</ul>
<br>
<hr>
API introduced: V3R1
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table></center>
</body>
</html>