aboutsummaryrefslogtreecommitdiff
path: root/socketserver.py
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2024-04-13 22:59:43 +0200
committerSébastien Dailly <sebastien@dailly.me>2024-04-13 22:59:43 +0200
commit89d3bb2421a42dccd4f159b77e9f7fb103a4f8b8 (patch)
treeedc50f8e27a8aba6449297a425e46d2d34378c32 /socketserver.py
parentc27035a029cdcbfb854ea0760fd083b5d8870c6d (diff)
Reliable connection in the sockets
Diffstat (limited to 'socketserver.py')
-rwxr-xr-xsocketserver.py4
1 files changed, 2 insertions, 2 deletions
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():