| | |
| | | import json |
| | | import multiprocessing |
| | | import threading |
| | | import time |
| | |
| | | socket.bind(f"ipc://order_{index}.ipc") |
| | | print("绑定成功", index) |
| | | while True: |
| | | msg = socket.recv_json() |
| | | msg = socket.recv_string() |
| | | print(f"Got Msg({index}): {msg}") |
| | | socket.send_string("SUCCESS") |
| | | |
| | |
| | | def send_data(context, i): |
| | | if i not in socket_client_dict: |
| | | socket = context.socket(zmq.REQ) |
| | | result = socket.connect(f"ipc://order_{i}.ipc") |
| | | print("连接结果:", result) |
| | | socket.connect(f"ipc://order_{i}.ipc") |
| | | socket_client_dict[i] = socket |
| | | |
| | | socket_client_dict[i].send_json({'msg': i}) |
| | | socket_client_dict[i].send_string(json.dumps({'msg': i})) |
| | | response = socket_client_dict[i].recv_string() |
| | | |
| | | |