try to recv smarter
This commit is contained in:
parent
649435c2c9
commit
cb91896b0d
4
net.py
4
net.py
@ -22,8 +22,8 @@ def recv(s: socket.socket):
|
|||||||
|
|
||||||
pickled = b""
|
pickled = b""
|
||||||
toread = length
|
toread = length
|
||||||
while toread:
|
while toread > 0:
|
||||||
read = s.recv(toread)
|
read = s.recv(toread)
|
||||||
pickled += read
|
pickled += read
|
||||||
toread -= len(pickled)
|
toread -= len(pickled)
|
||||||
return pickle.loads(pickled)
|
return pickle.loads(pickled[:length])
|
||||||
|
Loading…
Reference in New Issue
Block a user