Skip to content

Commit

Permalink
Fix WLANHandler.write returning None
Browse files Browse the repository at this point in the history
  • Loading branch information
bessman committed Feb 19, 2025
1 parent 5b30bff commit 10fd755
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pslab/connection/wlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,16 @@ def write(self, data: bytes) -> int:
numbytes : int
Number of bytes written.
"""
return self._sock.sendall(data)
buf_size = 4096
remaining = len(data)
sent = 0

while remaining > 0:
chunk = data[sent : min(remaining, buf_size)]
sent += self._sock.send(chunk)
remaining -= len(chunk)

return sent

def __repr__(self) -> str: # noqa
return f"{self.__class__.__name__}[{self.host}:{self.port}]"

0 comments on commit 10fd755

Please sign in to comment.