From e1c8518df2758b15962bfb685245b3af3bd49248 Mon Sep 17 00:00:00 2001 From: Fierelier Date: Wed, 14 Apr 2021 18:52:47 +0200 Subject: [PATCH] Add timeout variable to server --- fstream-server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fstream-server.py b/fstream-server.py index 412d7b0..078b74e 100644 --- a/fstream-server.py +++ b/fstream-server.py @@ -36,6 +36,7 @@ serverAddr = ("127.0.0.1",12000) serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) bufferSize = 1000 # Buffer size in bytes +timeout = 15 # How long to wait for a connection to respond before timing out? maxClients = 100 # How many clients can be connected at maximum? maxClientsPerIP = 5 # How many clients can be connected at maximum, per IP? maxAccumulatedData = 20*1000*1000 # How much data can be in an outbound thread's queue at maximum before the connection is closed? @@ -262,6 +263,7 @@ def main(): while True: connection, address = serverSocket.accept() + connection.settimeout(timeout) connection.settimeout(15) with connectionsLock: