(self, msg: str)
| 17 | self.location: Point = location |
| 18 | |
| 19 | def send(self, msg: str) -> str: |
| 20 | self.socket.sendall(str.encode(msg + ";")) |
| 21 | # TODO move to logging setup |
| 22 | #print(f"sent: {msg}") |
| 23 | buffer = b"" |
| 24 | while b";" not in buffer: |
| 25 | data = self.socket.recv(32) |
| 26 | buffer += data |
| 27 | response = buffer.decode("utf-8") |
| 28 | # strip the trailing ; |
| 29 | response = response[:-1] |
| 30 | # TODO move to logging setup |
| 31 | #print(f"recv: {response}") |
| 32 | return response |
| 33 | |
| 34 | def kind(self) -> str: |
| 35 | response = self.send("KIND") |