client.py
import cv2
import numpy as np
import socket
import sys
import pickle
import struct
cap=cv2.VideoCapture(0)
clientsocket=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
clientsocket.connect(('localhost',5000))
while True:
ret,frame=cap.read()
data = pickle.dumps(frame)
clientsocket.sendall(struct.pack("H", len(data))+data)
错误在最后一行。
错误:struct.error:ushort格式要求0< = number< = USHRT_MAX。
答案 0 :(得分:0)
修改" H"用" L"在客户端和服务器上。应该工作