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

📄 getsockname.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>getsockname</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>getsockname - get the socket name</blockquote><h4>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="syssocket.h.html">sys/socket.h</a>&gt;int getsockname(int <I>socket</I>, struct sockaddr *<I>address</I>,                socklen_t *<I>address_len</I>);</code></pre></blockquote><h4>DESCRIPTION</h4><blockquote>The<i>getsockname()</i>function retrieves the locally-bound name of the specified socket, stores thisaddress in the <B>sockaddr</B> structure pointed to by the <I>address</I>argument, and stores the length of this address in the object pointed to bythe <I>address_len</I> argument.<p>If the actual length of the address is greater than the length of thesupplied <B>sockaddr</B> structure, the stored address will betruncated.<p>If the socket has not been bound to a local name, the value stored in theobject pointed to by <I>address</I> is unspecified.</blockquote><h4>RETURN VALUE</h4><blockquote>Upon successful completion, 0 is returned, the <I>address</I>argument points to the address of the socket, and the <I>address_len</I>argument points to the length of the address.  Otherwise, -1 isreturned and <I>errno</I> is set to indicate the error.</blockquote><h4>ERRORS</h4><blockquote>The<i>getsockname()</i>function will fail:<dl compact><dt>[EBADF]<dd>The <I>socket</I> argument is not a valid file descriptor.<dt>[EFAULT]<dd>The <I>address</I>or <I>address_len</I>parameter can not be accessed or written.<dt>[ENOTSOCK]<dd>The <I>socket</I> argument does not refer to a socket.<dt>[EOPNOTSUPP]<dd>The operation is not supported for this socket's protocol.</dl><p>The<i>getsockname()</i>function may fail if:<dl compact><dt>[EINVAL]<dd>The socket has been shut down.<dt>[ENOBUFS]<dd>Insufficient resources were available in the system to complete the call.<dt>[ENOSR]<dd>There were insufficient STREAMS resources available for the operation tocomplete.</dl></blockquote><h4>SEE ALSO</h4><blockquote><i><a href="accept.html">accept()</a></i>,<i><a href="bind.html">bind()</a></i>,<i><a href="getpeername.html">getpeername()</a></i>,<i><a href="socket.html">socket()</a></i>,<i><a href="syssocket.h.html">&lt;sys/socket.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 + -