From 329b5629e5fded44948d9ea00cb0c89be6300ecb Mon Sep 17 00:00:00 2001 From: Fierelier Date: Wed, 14 Apr 2021 18:52:18 +0200 Subject: [PATCH] Add timeout variable to client --- fstream-client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fstream-client.py b/fstream-client.py index a77c350..856b4de 100644 --- a/fstream-client.py +++ b/fstream-client.py @@ -24,6 +24,7 @@ import threading import queue bufferSize = 1000 # buffer size in bytes +timeout = 15 # timeout in seconds connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) class stdoutThread(threading.Thread): @@ -33,7 +34,7 @@ class stdoutThread(threading.Thread): def run(self): while True: - data = self.queue.get() + data = self.queue.get(timeout=timeout) sys.stdout.buffer.write(data) def listToCommand(lst): @@ -59,7 +60,7 @@ def main(): serverAddr = sys.argv[1].rsplit(":",1) serverAddr[1] = int(serverAddr[1]) serverAddr = tuple(serverAddr) - connection.settimeout(15) + connection.settimeout(timeout) connection.connect(serverAddr) connection.sendall(makePayload(sys.argv[2:]))