From cb91896b0dea2cb61d3112229353d1fcbcd0250d Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Thu, 18 Apr 2024 17:46:56 +0200 Subject: [PATCH] try to recv smarter --- net.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net.py b/net.py index c4d0bb9..3f93f23 100644 --- a/net.py +++ b/net.py @@ -22,8 +22,8 @@ def recv(s: socket.socket): pickled = b"" toread = length - while toread: + while toread > 0: read = s.recv(toread) pickled += read toread -= len(pickled) - return pickle.loads(pickled) + return pickle.loads(pickled[:length])