first commit

This commit is contained in:
2023-01-26 13:56:18 +08:00
commit 4abe6bf738
17 changed files with 1105 additions and 0 deletions

34
python/test_server.py Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# Copyright (c) 2023 - present, Anton Anikin <anton@anikin.xyz>
# All rights reserved.
import numpy as np
import sys
from ipc import Ipc
if __name__ == '__main__':
assert len(sys.argv) >= 3
ipc_name = sys.argv[1]
is_server = sys.argv[2] == "1"
print("[python] pre-start")
ipc = Ipc(ipc_name, is_server)
print("[python] start")
while True:
value = ipc.read_int_opt()
if value is None:
break
print(f"[python] read int({value})")
# result = value * value
result = np.sqrt(value)
ipc.write_double(result)
print(f"[python] write double({result:.2e})")
print("[python] finish the work\n");