This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import socket
import sys,json
import numpy as np
# 创建 socket 对象
serversocket = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
# 获取本地主机名,本机的ip
host = '192.168.220.151'
port = 9999
# 绑定端口号
serversocket.connect((host, port))
# 设置最大连接数,超过后排队
while True:
# 建立客户端连接
msg = serversocket.recv(4096)
msg = msg.decode('utf-8')
recvmsg = json.loads(msg)
print(recvmsg)