Read from the socket until the character is received.
(sock: socket.socket, char: bytes)
| 62 | |
| 63 | |
| 64 | def _read_until(sock: socket.socket, char: bytes) -> bytes: |
| 65 | """ |
| 66 | Read from the socket until the character is received. |
| 67 | """ |
| 68 | chunks = [] |
| 69 | while True: |
| 70 | chunk = sock.recv(1) |
| 71 | chunks.append(chunk) |
| 72 | if chunk == char: |
| 73 | break |
| 74 | |
| 75 | return b"".join(chunks) |
| 76 | |
| 77 | |
| 78 | def _address_from_socket(sock: socket.socket) -> bytes | str: |
no test coverage detected