You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Conception/yolov5-6.2/ip.py

22 lines
471 B

This file contains ambiguous Unicode characters!

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)