📄 getpeername.2
字号:
.\" SCCSID: @(#)getpeername.2 8.1 9/11/90.TH getpeername 2.SH Namegetpeername \- get name of connected peer.SH Syntax.nf.B #include <sys/types.h>.B #include <sys/socket.h>.PP.ft Bgetpeername(s, name, namelen)int s;struct sockaddr *name;int *namelen;.fi.SH Description.NXR "getpeername system call".NXR "socket" "getting peer name"The.PN getpeernamereturns the name of the peer connected tosocket.IR s .The.I namelenparameter should be initialized to indicatethe amount of space pointed to by.IR name .On return, it contains the actual size, in bytes, of the namereturned..SH Return ValuesA zero is returned if the call succeeds, and \-1 is returned if it fails..SH RestrictionsNames bound to sockets in the UNIX domain are inaccessible;.PN getpeernamereturns a zero length name..SH DiagnosticsThe call succeeds unless:.TP 15[EBADF]The argument \fIs\fP is not a valid descriptor..TP 15[ENOTSOCK]The argument \fIs\fP is a file, not a socket..TP 15[ENOTCONN]The socket is not connected..TP 15[ENOBUFS]Insufficient resources were available in the systemto perform the operation..TP 15[EFAULT]The .I nameparameter points to memory not in a valid part of theprocess address space..SH See Alsobind(2), getsockname(2), socket(2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -