From 89d3bb2421a42dccd4f159b77e9f7fb103a4f8b8 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sat, 13 Apr 2024 22:59:43 +0200 Subject: Reliable connection in the sockets --- socketserver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'socketserver.py') diff --git a/socketserver.py b/socketserver.py index 471b8be..0a7e9d4 100755 --- a/socketserver.py +++ b/socketserver.py @@ -104,12 +104,12 @@ class Handler(object): def _read(self:object, conn:socket, mask:int): """ Internal method used to retreive data from the socket """ - data = conn.recv(1024).strip() + data = conn.recv(1024) if data == bytes("", "ascii"): # A socket ready but sending garbage is a dead socket. self.close(conn) return - json_data = str(data, "utf-8") + json_data = str(data.strip(), "utf-8") try: js = json.loads(json_data) for key in js.keys(): -- cgit v1.2.3