diff options
| author | 2023-04-08 15:21:04 +0000 | |
|---|---|---|
| committer | 2023-04-08 15:21:04 +0000 | |
| commit | 52279a9afc6afb3c589216e3f930e3d8d96dd119 (patch) | |
| tree | e9be1050df499c261d68bfb5c3d2ece7a10a700a /asm/comm.py | |
| parent | change data to base 10 instead of base 16 (diff) | |
add communications testupsilon
Diffstat (limited to 'asm/comm.py')
| -rw-r--r-- | asm/comm.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/asm/comm.py b/asm/comm.py new file mode 100644 index 0000000..9a6c188 --- /dev/null +++ b/asm/comm.py @@ -0,0 +1,18 @@ +from creole import * +import socket + +def connect(ip, port): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((ip, port)) + return s + +def execute(creole_instance, socket): + code = creole_instance() + l = len(code) + assert l <= 0xFFFF + socket.sendall(bytes([l & 0xFF, l >> 8]) + code) + +def connect_exec(cr, ip="192.168.1.50", port=6626): + s = connect(ip, port) + execute(cr, s) + return s.recv(1024) |
