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

152 lines
3.7 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>res_close()--Close Socket and Reset _res Structure</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. -->
<!-- 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 -->
<!--End Header Records -->
<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>res_close()--Close Socket and Reset _res Structure</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;sys/types.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;arpa/nameser.h&gt;
#include &lt;resolv.h&gt;
void res_close(void)
</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: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <em>res_close()</em> function is used to reset the <strong>_res</strong>
structure to the beginning defaults and close a socket that is opened as a
result of the RES_STAYOPEN flag.</p>
<br>
<h3>Authorities:</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<p>None</p>
<br>
<h3>Usage Notes</h3>
<ol>
<li>If <em>res_send()</em> was previously called with RES_STAYOPEN set in the
options field of the <strong>_res</strong> structure, <em>res_close()</em>
closes the socket that was left open. <em>res_close()</em> does not attempt the
close if there was no socket left open.<br>
<br>
</li>
<li><em>res_close()</em> sets the <strong>_res</strong> structure to default
values.<br>
<ul>
<li>The <em>retrans</em> field is set to 5.
</li>
<li>The <em>retry</em> field is set to 4.</li>
<li>The <em>options</em> field has the RES_RECURSE, RES_DEFDNAMES, and
RES_DNSSRCH bits set.</li>
<li>The <em>nscount</em> field is set to 1.</li>
<li>All other fields in the <strong>_res</strong> structure are cleared.</li>
<li>In a thread-enabled environment <strong>_res</strong> structure is shared
among all threads within a process.</li>
</ul>
</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="resnclose.htm">res_nclose()</a>--Close Socket and Reset res
Structure<br>
<br>
</li>
<li><a href="reshostalias.htm">res_hostalias()</a>--Retrieve the host alias<br>
<br>
</li>
<li><a href="resini.htm">res_init()</a>--Initialize _res Structure<br>
<br>
</li>
<li><a href="resmkq.htm">res_mkquery()</a>--Place Domain Query in Buffer<br>
<br>
</li>
<li><a href="resqry.htm">res_query()</a>--Send Domain Query<br>
<br>
</li>
<li><a href="ressch.htm">res_search()</a>--Search for Domain Name<br>
<br>
</li>
<li><a href="ressnd.htm">res_send()</a>--Send Buffered Domain Query<br>
<br>
</li>
<li><a href="resxlt.htm">res_xlate()</a>--Translate DNS Packets</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>