Read *exactly* ``amt`` bytes from the socket ``sock``.
(sock: socket.socket, amt: int)
| 48 | |
| 49 | |
| 50 | def _read_exactly(sock: socket.socket, amt: int) -> bytes: |
| 51 | """ |
| 52 | Read *exactly* ``amt`` bytes from the socket ``sock``. |
| 53 | """ |
| 54 | data = b"" |
| 55 | |
| 56 | while amt > 0: |
| 57 | chunk = sock.recv(amt) |
| 58 | data += chunk |
| 59 | amt -= len(chunk) |
| 60 | |
| 61 | return data |
| 62 | |
| 63 | |
| 64 | def _read_until(sock: socket.socket, char: bytes) -> bytes: |
no test coverage detected