From 5a2ef3a696ddccbc1faef1e2e90f5b535ec24a0d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 11 一月 2024 10:06:14 +0800
Subject: [PATCH] 看盘网页修改/接口本地化代理

---
 utils/network_util.py |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/network_util.py b/utils/network_util.py
similarity index 61%
rename from network_util.py
rename to utils/network_util.py
index 831bcd8..60b54fe 100644
--- a/network_util.py
+++ b/utils/network_util.py
@@ -4,10 +4,13 @@
 import requests
 
 import constant
+from utils import socket_util
 
-SOCKET_PORT = 9001
+SOCKET_PORT = 11008
 # B绫�
 HTTP_PORT = 9004
+
+
 # A绫�
 # HTTP_PORT = 9005
 
@@ -16,11 +19,15 @@
     client = socket.socket()  # 鐢熸垚socket锛岃繛鎺erver
     ip_port = (constant.SERVER_HOST, SOCKET_PORT)  # server鍦板潃鍜岀鍙e彿锛堟渶濂芥槸10000浠ュ悗锛�
     client.connect(ip_port)
-    client.send(json.dumps(data).encode("utf-8"))
+    if type(data) != str:
+        client.send(socket_util.load_header(json.dumps(data).encode("utf-8")))
+    else:
+        client.send(socket_util.load_header(data.encode("utf-8")))
     # 璇诲彇鍐呭
-    result = client.recv(102400)
+    result, header = socket_util.recv_data(client)
+    print("socket_request缁撴灉锛�", result)
     client.close()
-    return result.decode("gbk")
+    return result
 
 
 def http_get(path):

--
Gitblit v1.8.0