first commit

This commit is contained in:
lihansani
2026-07-13 15:37:05 +08:00
commit 8b11aa2efc
299 changed files with 206339 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import socket
import json
import time
def receive_vdes_data():
HOST = 'localhost' # 模拟器运行的地址
PORT = 8082 # 模拟器监听的端口
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
print(f"已连接到VDES数据模拟器 {HOST}:{PORT}")
while True:
# 接收数据(阻塞直到有数据)
data = s.recv(65536) # 足够大的缓冲区
# if not data:
# break
if data:
ships_data = json.loads(data.decode('utf-8'))
print(f"收到 {len(ships_data)} 条船舶数据")
print(ships_data)
receive_vdes_data()