adapt to min value of 1 for listen() backlog argument

This commit is contained in:
Guido van Rossum 1994-03-02 10:52:16 +00:00
parent b5f2714e94
commit 5da5755c4a
2 changed files with 6 additions and 6 deletions

View File

@ -157,8 +157,8 @@ encoded as strings).
\begin{funcdesc}{listen}{backlog} \begin{funcdesc}{listen}{backlog}
Listen for connections made to the socket. Listen for connections made to the socket.
The argument (in the range 0-5) specifies the maximum number of The argument specifies the maximum number of queued connections and
queued connections. should be at least 1; the maximum value is system-dependent.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{makefile}{mode} \begin{funcdesc}{makefile}{mode}
@ -234,7 +234,7 @@ HOST = '' # Symbolic name meaning the local host
PORT = 50007 # Arbitrary non-privileged server PORT = 50007 # Arbitrary non-privileged server
s = socket(AF_INET, SOCK_STREAM) s = socket(AF_INET, SOCK_STREAM)
s.bind(HOST, PORT) s.bind(HOST, PORT)
s.listen(0) s.listen(1)
conn, addr = s.accept() conn, addr = s.accept()
print 'Connected by', addr print 'Connected by', addr
while 1: while 1:

View File

@ -157,8 +157,8 @@ encoded as strings).
\begin{funcdesc}{listen}{backlog} \begin{funcdesc}{listen}{backlog}
Listen for connections made to the socket. Listen for connections made to the socket.
The argument (in the range 0-5) specifies the maximum number of The argument specifies the maximum number of queued connections and
queued connections. should be at least 1; the maximum value is system-dependent.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{makefile}{mode} \begin{funcdesc}{makefile}{mode}
@ -234,7 +234,7 @@ HOST = '' # Symbolic name meaning the local host
PORT = 50007 # Arbitrary non-privileged server PORT = 50007 # Arbitrary non-privileged server
s = socket(AF_INET, SOCK_STREAM) s = socket(AF_INET, SOCK_STREAM)
s.bind(HOST, PORT) s.bind(HOST, PORT)
s.listen(0) s.listen(1)
conn, addr = s.accept() conn, addr = s.accept()
print 'Connected by', addr print 'Connected by', addr
while 1: while 1: