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

📄 getservbyname.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>endservent</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>endservent, getservbyport, getservbyname, getservent, setservent - network services database functions</blockquote><h4>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="netdb.h.html">netdb.h</a>&gt;void endservent(void);struct servent *getservbyname(const char *<I>name</I>, const char *<I>proto</I>);struct servent *getservbyport(int <I>port</I>, const char *<I>proto</I>);struct servent *getservent(void);void setservent(int <I>stayopen</I>);</code></pre></blockquote><h4>DESCRIPTION</h4><blockquote>The<i>getservbyname()</i>,<i><a href="getservbyport.html">getservbyport()</a></i>and<i>getservent()</i>functions each return a pointer to a <B>servent</B> structure, the members ofwhich contain the fields of an entry in the network services database.<p>The<i>getservent()</i>function reads the next entry of the database, opening a connection to thedatabase if necessary.<p>The<i>getservbyname()</i>function searches the database from the beginning and finds the first entryfor which the service name specified by <I>name</I> matches the <B>s_name</B>member and the protocol name specified by <I>proto</I> matches the<B>s_proto</B> member, opening a connection to the database if necessary.  If<I>proto</I> is a null pointer, any value of the <B>s_proto</B> member will bematched.<p>The<i><a href="getservbyport.html">getservbyport()</a></i>function searches the database from the beginning and finds the first entryfor which the port specified by <I>port</I> matches the <B>s_port</B> member andthe protocol name specified by <I>proto</I> matches the <B>s_proto</B> member,opening a connection to the database if necessary.  If <I>proto</I> is a nullpointer, any value of the <B>s_proto</B> member will be matched.  The<I>port</I> argument must be in network byte order.<p>The<i><a href="setservent.html">setservent()</a></i>function opens a connection to the database, and sets the next entry to thefirst entry.  If the <I>stayopen</I> argument is non-zero, the net databasewill not be closed after each call to the<i>getservent()</i>function (either directly, or indirectly through one of the other<i>getserv*()</i>functions).<p>The<i>endservent()</i>function closes the database.</blockquote><h4>RETURN VALUES</h4><blockquote>On successful completion,<i>getservbyname()</i>,<i><a href="getservbyport.html">getservbyport()</a></i>and<i>getservent()</i>return a pointer to a <B>servent</B> structure if the requested entry wasfound, and a null pointer if the end of the database was reached or therequested entry was not found.  Otherwise, a null pointer is returned.</blockquote><h4>ERRORS</h4><blockquote>No errors are defined.</blockquote><h4>APPLICATION USAGE</h4><blockquote>The <I>port</I> argument of<i><a href="getservbyport.html">getservbyport()</a></i>need not be compatible with the port values of all address families.<p>The<i>getservent()</i>,<i>getservbyname()</i>and<i><a href="getservbyport.html">getservbyport()</a></i>functions may return pointers to static data, which may be overwritten bysubsequent calls to any of these functions.<p>These functions are generally used with the Internet address family.<br></blockquote><h4>SEE ALSO</h4><blockquote><i><a href="endhostent.html">endhostent()</a></i>,<i><a href="endprotoent.html">endprotoent()</a></i>,<i><a href="htonl.html">htonl()</a></i>,<i><a href="inet_addr.html">inet_addr()</a></i>,<i><a href="netdb.h.html">&lt;netdb.h&gt;</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 + -