Files
darkfi/bin/app/echo.py
G10h4ck 1a232e67ad chore: Fix python scripts shebang
Avoid python scripts "escaping" from venv
2025-02-17 12:14:14 +00:00

22 lines
479 B
Python
Executable File

#!/usr/bin/env python
import zmq
from pydrk import serial
context = zmq.Context()
socket = context.socket(zmq.REQ)
#self.socket.setsockopt(zmq.IPV6, True)
socket.connect(f"tcp://127.0.0.1:9484")
req_cmd = bytearray()
serial.write_u8(req_cmd, 0)
payload = bytearray()
socket.send_multipart([req_cmd, payload])
errc, reply = socket.recv_multipart()
errc = int.from_bytes(errc, "little")
cursor = serial.Cursor(reply)
response = serial.decode_str(cursor)
print(errc, response)