From 777c320ce4f4564c2b70c296dcebc846e5f49e0f Mon Sep 17 00:00:00 2001 From: berhsi Date: Sat, 27 Jul 2019 16:49:08 +0200 Subject: [PATCH] setstatus.py: its possible now to pass a integer to main() to perform a stresstest its possible now to pass an integer as argument to main() --- client-clear.py => setstatus.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) rename client-clear.py => setstatus.py (89%) diff --git a/client-clear.py b/setstatus.py similarity index 89% rename from client-clear.py rename to setstatus.py index 8d70dfa..4f7d800 100755 --- a/client-clear.py +++ b/setstatus.py @@ -49,18 +49,23 @@ def read_argument(): return status -def main(): +def main(*status): - HOST = 'nr18.space' + HOST = 'localhost' PORT = 10001 BOM = byteorder STATUS = None RESPONSE = None - if check_arguments(argv) == None: - STATUS = read_argument() + if status: + STATUS = status[0] + STATUS = bytes([STATUS]) + print('Status: {}'.format(STATUS)) else: - STATUS = check_arguments(argv) + if len(argv) == 1: + STATUS = read_argument() + else: + STATUS = check_arguments(argv) with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as mySocket: print('Socket created')