⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 netdb.h.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>&lt;netdb.h&gt;</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4>NAME</h4><blockquote>netdb.h - definitions for network database operations</blockquote><h4>SYNOPSIS</h4><blockquote><pre><code>#include &lt;netdb.h&gt;</code></pre></blockquote><h4>DESCRIPTION</h4><blockquote>The<i>&lt;netdb.h&gt;</i>header may make available the type <B>in_port_t</B> and the type <B>in_addr_t</B> asdefined in the description of<i><a href="netinetin.h.html">&lt;netinet/in.h&gt;</a></i>.<p>The<i>&lt;netdb.h&gt;</i>header defines the<B>hostent</B>structure that includes at least the following members:<pre><code>char  *h_name      Official name of the host.char **h_aliases   A pointer to an array of pointers to alternative host names,                   terminated by a null pointer.int    h_addrtype  Address type.int    h_length    The length, in bytes, of the address.char **h_addr_list A pointer to an array of pointers to network addresses (in                   network byte order) for the host, terminated by a null pointer.</code></pre>The<i>&lt;netdb.h&gt;</i>header defines the<B>netent</B>structure that includes at least the following members:<pre><code>char  *n_name      Official, fully-qualified (including the domain) name of the host.char **n_aliases   A pointer to an array of pointers to alternative network names,                   terminated by a null pointer.int    n_addrtype  The address type of the network.uint32_t n_net     The network number, in host byte order.</code></pre><p>The uint_32_t type is made available by inclusion of<i>&lt;inttypes.h&gt;</i>(see referenced document <B>XSH</B>).<p>The<i>&lt;netdb.h&gt;</i>header defines the<B>protoent</B>structure that includes at least the following members:<pre><code>char  *p_name      Official name of the protocol.char **p_aliases   A pointer to an array of pointers to alternative protocol names,                   terminated by a null pointer.int    p_proto     The protocol number.</code></pre>The<i>&lt;netdb.h&gt;</i>header defines the<B>servent</B>structure that includes at least the following members:<pre><code>char  *s_name      Official name of the service.char **s_aliases   A pointer to an array of pointers to alternative service names,                   terminated by a null pointer.int    s_port      The port number at which the service resides, in network byte order.char  *s_proto     The name of the protocol to use when contacting the service.</code></pre>The<i>&lt;netdb.h&gt;</i>header defines the macro IPPORT_RESERVED with the value of the highestreserved Internet port number.<p>The<i>&lt;netdb.h&gt;</i>header provides a declaration of<I>h_errno</I>as a modifiable l-value of type <B>int</B>.For example:<pre><code>extern int h_errno;</code></pre><p>The<i>&lt;netdb.h&gt;</i>header defines the following macros for use as error values for<i><a href="gethostbyaddr.html">gethostbyaddr()</a></i>and<i><a href="gethostbyname.html">gethostbyname()</a></i>:<dl compact><dt>HOST_NOT_FOUND<dd><dt>NO_DATA<dd><dt>NO_RECOVERY<dd><dt>TRY_AGAIN<dd></dl><p>The following are declared as functions, and may also be defined as macros:<pre><code>void             <a href="endhostent.html">endhostent</a>(void);void             <a href="endnetent.html">endnetent</a>(void);void             <a href="endprotoent.html">endprotoent</a>(void);void             <a href="endservent.html">endservent</a>(void);struct hostent  *<a href="gethostbyaddr.html">gethostbyaddr</a>(const void *<I>addr</I>, size_t <I>len</I>, int <I>type</I>);struct hostent  *<a href="gethostbyname.html">gethostbyname</a>(const char *<I>name</I>);struct hostent  *<a href="gethostent.html">gethostent</a>(void);struct netent   *<a href="getnetbyaddr.html">getnetbyaddr</a>(uint32_t <I>net</I>, int <I>type</I>);struct netent   *<a href="getnetbyname.html">getnetbyname</a>(const char *<I>name</I>);struct netent   *<a href="getnetent.html">getnetent</a>(void);struct protoent *<a href="getprotobyname.html">getprotobyname</a>(const char *<I>name</I>);struct protoent *<a href="getprotobynumber.html">getprotobynumber</a>(int <I>proto</I>);struct protoent *<a href="getprotoent.html">getprotoent</a>(void);struct servent  *<a href="getservbyname.html">getservbyname</a>(const char *<I>name</I>, const char *<I>proto</I>);struct servent  *<a href="getservbyport.html">getservbyport</a>(int <I>port</I>, const char *<I>proto</I>);struct servent  *<a href="getservent.html">getservent</a>(void);void             <a href="sethostent.html">sethostent</a>(int <I>stayopen</I>);void             <a href="setnetent.html">setnetent</a>(int <I>stayopen</I>);void             <a href="setprotoent.html">setprotoent</a>(int <I>stayopen</I>);void             <a href="setservent.html">setservent</a>(int <I>stayopen</I>);</code></pre>Inclusion of the<i>&lt;netdb.h&gt;</i>header may also make visible all symbols from<i><a href="netinetin.h.html">&lt;netinet/in.h&gt;</a></i>and<i><a href="../xsh/inttypes.h.html">&lt;inttypes.h&gt;</a></i>.</blockquote><h4>SEE ALSO</h4><blockquote><i><a href="endhostent.html">endhostent()</a></i>,<i><a href="endnetent.html">endnetent()</a></i>,<i><a href="endprotoent.html">endprotoent()</a></i>,<i><a href="endservent.html">endservent()</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -