admin
2025-06-10 568c763084b926a6f2d632b7ac65b9ec8280752f
utils/network_util.py
@@ -15,9 +15,9 @@
# HTTP_PORT = 9005
def socket_request(data):
def socket_request(data, host=constant.SERVER_HOST, port=SOCKET_PORT):
    client = socket.socket()  # 生成socket,连接server
    ip_port = (constant.SERVER_HOST, SOCKET_PORT)  # server地址和端口号(最好是10000以后)
    ip_port = (host, port)  # server地址和端口号(最好是10000以后)
    client.connect(ip_port)
    if type(data) != str:
        client.send(socket_util.load_header(json.dumps(data).encode("utf-8")))