try to recv smarter

This commit is contained in:
Robert Bendun 2024-04-18 17:46:56 +02:00
parent 649435c2c9
commit cb91896b0d

4
net.py
View File

@ -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])