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

161 lines
4.4 KiB
HTML

<!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>sethostent()--Open Host Database</title>
<!-- 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. -->
<!-- Begin Header Records ========================================== -->
<!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!--End Header Records -->
<!-- Edited by Kersten Feb 02 -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>sethostent()--Open Host Database</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;netdb.h&gt;
void sethostent(int <em>stay_open</em>)
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QSOSRV2<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: No; see <a href="#USAGE_NOTES">Usage Notes</a>.<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <em>sethostent()</em> function is used to prepare for sequential access
to the host database file. <em>sethostent()</em> opens the file and repositions
the file marker to the beginning of the file. In addition,
<em>sethostent()</em> affects what type of transport service (connectionless
versus connection-oriented) is to be used when <em>gethostbyname()</em> and
<em>gethostbyaddr()</em> need to retrieve host information from the domain name
server.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt>int <strong>stay_open</strong></dt>
<dd>(Input) Specifies whether to leave the database file open after each call
to <em>gethostbyname()</em> and <em>gethostbyaddr()</em>. A nonzero value
results in the database file being left open. Also, a nonzero value results in
the use of a connection-oriented transport service (for example, TCP) being
used by <em>gethostbyname()</em> and <em>gethostbyaddr()</em> when host
information is to be obtained from the domain name server.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Error Conditions</h3>
<p>When <em>sethostent()</em> fails, <em>h_errno</em> (defined in
<strong>&lt;netdb.h&gt;</strong>) can be set to one of the following:</p>
<dl>
<dt><em><samp>NO_RECOVERY</samp></em></dt>
<dd><p>An unrecoverable error has occurred.</p></dd>
</dl>
<br>
<h3><a name="USAGE_NOTES">Usage Notes</a></h3>
<ol>
<li>The iSeries Navigator or the following CL commands can be
used to access the host database file: <br><br>
<ul>
<li>ADDTCPHTE (Add TCP/IP Host Table Entry</li>
<li>RMVTCPHTE (Remove TCP/IP Host Table Entry)</li>
<li>CHGTCPHTE (Change TCP/IP Host Table Entry)</li>
<li>RNMTCPHTE (Rename TCP/IP Host Table Entry)</li>
<li>MRGTCPHT (Merge TCP/IP Host Tables)</li>
</ul>
<br>
</li>
<li>Do not use the <em>sethostent()</em> function in a multithreaded
environment. See the multithread alternative <em>sethostent_r()</em>
function.<br>
<br>
</li>
<li>When you develop in C-based languages and an application is compiled with
the _XOPEN_SOURCE macro defined to the value 520 or greater, the <em>sethostent()</em>
API is mapped to<em>qso_sethostent98()</em>.</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="_xopen_source.htm">_XOPEN_SOURCE</a>--Using _XOPEN_SOURCE for the UNIX 98
compatible interface<br>
<br>
</li>
<li><a href="ghosta.htm">gethostbyaddr()</a>--Get Host Information for IP
Address<br>
<br>
</li>
<li><a href="ghostnm.htm">gethostbyname()</a>--Get Host Information for Host
Name<br>
<br>
</li>
<li><a href="ehostnt.htm">endhostent()</a>--Close Host Database<br>
<br>
</li>
<li><a href="ghostnt.htm">gethostent()</a>--Get Next Entry from Host
Database</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>