server-clear.py: backlog changed and timeout added
the server has now a limit of 5 connections in socket.listen(). added a timeout from 3 seconds to the connection
This commit is contained in:
parent
dc088179f5
commit
4bbd2aed54
1 changed files with 2 additions and 1 deletions
|
@ -50,7 +50,7 @@ def main():
|
|||
print('Socket created')
|
||||
try:
|
||||
mySocket.bind((HOST, PORT))
|
||||
mySocket.listen()
|
||||
mySocket.listen(5)
|
||||
print('Listen on {} at Port {}'.format(HOST, PORT))
|
||||
except Exception as e:
|
||||
print('Error: unable to bind and listen')
|
||||
|
@ -60,6 +60,7 @@ def main():
|
|||
try:
|
||||
conn, addr = mySocket.accept()
|
||||
print('Connection from {}:{}'.format(addr[0], addr[1]))
|
||||
conn.settimeout(3.0)
|
||||
connection_handle(conn)
|
||||
except KeyboardInterrupt:
|
||||
print('\b\bExit')
|
||||
|
|
Loading…
Reference in a new issue