📄 listen.2
字号:
.\" SCCSID: @(#)listen.2 8.1 9/11/90.TH listen 2.SH Namelisten \- listen for connections on a socket.SH Syntax.nf.ft Blisten(s, backlog)int s, backlog;.fi.SH Description.NXR "listen system call".NXR "listen system call" "accept system call".NXR "socket" "queuing connections"To accept connections, a socketis first created with a.PN socket call, a backlog for incoming connections is specified with .PN listen , and then the connections are accepted with the.PN accept call.The.PN listencall is needed only for sockets of typeSOCK_STREAMorSOCK_SEQPACKET..PPThe.I backlogparameter defines the maximum length the queue ofpending connections may grow to.If a connectionrequest arrives with the queue full, the client receives an error with an indication of ECONNREFUSED..SH Restrictions The .I backlogis currently limited to 8..SH Return ValuesA 0 return value indicates success. A \-1 indicates an error..SH DiagnosticsThe call fails under the following conditions:.TP 15[EBADF]The argument \fIs\fP is not a valid descriptor..TP 15[ENOTSOCK]The argument \fIs\fP is not a socket..TP 15[EOPNOTSUPP]The socket is not of a type that supports the operation .PN listen ..SH See Alsoaccept(2), connect(2), socket(2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -