Преглед на файлове

Sets the server's socket timeout to 30.0 seconds.

As the server is single threaded, it's better to have a short socket timeout
configured, such that waiting for data from the client may terminate early in
case of a connection problem. The server then can continue waiting for other
peers.
Stefan Laudemann преди 9 години
родител
ревизия
efcba2c2ed
променени са 1 файла, в които са добавени 1 реда и са изтрити 0 реда
  1. 1 0
      server.py

+ 1 - 0
server.py

@@ -14,6 +14,7 @@ def server(port, bindTo):
 	BUFFER_SIZE = 1024
  
 	s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+	s.settimeout(30.0)
 	s.bind((bindTo, port))
 	s.listen(1)
 	print('DebugReport server listening on [{0}]:{1}'.format(bindTo, port))