Click here to Skip to main content
15,848,157 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to stream a webcam feed from a python server using cv2 video capture to a c# ,the client connects to the server without a problem but nothing shows on the pictureEdit(devexpress pictureEdit control);

What I have tried:

This is my Python server:
import socket

import cv2
import imutils

server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host_name  = socket.gethostname()
host_ip = socket.gethostbyname(host_name)
print('HOST IP:',host_ip)
port = 9999
socket_address = (host_ip,port)
print("LISTENING AT:",socket_address)
while True:
    client_socket, addr = server_socket.accept()
    print('GOT CONNECTION FROM:', addr)
    if client_socket:
        vid = cv2.VideoCapture(0)

        while (vid.isOpened()):
            img, frame =
            ret, buffer = cv2.imencode('.jpg', frame)

            file = open("image.jpg",'br')
            #a = pickle.dumps(frame)
            #message = struct.pack("Q", len(a)) + a


            #cv2.imshow('TRANSMITTING VIDEO', frame)
            key = cv2.waitKey(1) & 0xFF
            if key == ord('q'):

And this is my client side code:
private void startFeed()
           // Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
           //IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(""), 9999);
           TcpClient socket = new TcpClient();
           while (true)
               try {
               NetworkStream stream = socket.GetStream();
               byte[] bytes = new byte[socket.ReceiveBufferSize];
                   stream.Read(bytes, 0,bytes.Length) ;

               pictureEdit1.EditValue = bytes;
               }catch(Exception e)
Gerry Schmitz 29-Apr-21 18:41pm    
So this is actually a "DevExpress control not working" question.
hado25 29-Apr-21 19:36pm    
no devexpress pictureEdit allows me to read images directy as a byte[]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900