Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5da5755

Browse files
committed
adapt to min value of 1 for listen() backlog argument
1 parent b5f2714 commit 5da5755

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Doc/lib/libsocket.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ \subsection{Socket Object Methods}
157157

158158
\begin{funcdesc}{listen}{backlog}
159159
Listen for connections made to the socket.
160-
The argument (in the range 0-5) specifies the maximum number of
161-
queued connections.
160+
The argument specifies the maximum number of queued connections and
161+
should be at least 1; the maximum value is system-dependent.
162162
\end{funcdesc}
163163

164164
\begin{funcdesc}{makefile}{mode}
@@ -234,7 +234,7 @@ \subsection{Example}
234234
PORT = 50007 # Arbitrary non-privileged server
235235
s = socket(AF_INET, SOCK_STREAM)
236236
s.bind(HOST, PORT)
237-
s.listen(0)
237+
s.listen(1)
238238
conn, addr = s.accept()
239239
print 'Connected by', addr
240240
while 1:

Doc/libsocket.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ \subsection{Socket Object Methods}
157157

158158
\begin{funcdesc}{listen}{backlog}
159159
Listen for connections made to the socket.
160-
The argument (in the range 0-5) specifies the maximum number of
161-
queued connections.
160+
The argument specifies the maximum number of queued connections and
161+
should be at least 1; the maximum value is system-dependent.
162162
\end{funcdesc}
163163

164164
\begin{funcdesc}{makefile}{mode}
@@ -234,7 +234,7 @@ \subsection{Example}
234234
PORT = 50007 # Arbitrary non-privileged server
235235
s = socket(AF_INET, SOCK_STREAM)
236236
s.bind(HOST, PORT)
237-
s.listen(0)
237+
s.listen(1)
238238
conn, addr = s.accept()
239239
print 'Connected by', addr
240240
while 1:

0 commit comments

Comments
 (0)