()
| 5 | import sys |
| 6 | |
| 7 | def recv_klog(): |
| 8 | host = '10.0.0.169' |
| 9 | port = 9081 |
| 10 | |
| 11 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: |
| 12 | s.connect((host, port)) |
| 13 | while True: |
| 14 | try: |
| 15 | data = s.recv(0x100) |
| 16 | if not data: |
| 17 | break |
| 18 | print(data.decode('utf-8')) |
| 19 | except socket.timeout: |
| 20 | print("[ERROR] Timeout reached for receiving data (1 min)\n") |
| 21 | break |
| 22 | except socket.error: |
| 23 | print("[ERROR] Failed to read from socket\n") |
| 24 | break |
| 25 | |
| 26 | s.close() |
| 27 | |
| 28 | if __name__ == '__main__': |
| 29 | recv_klog() |