Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:54:31+00:00 2026-06-09T05:54:31+00:00

I captured video stream with Kinect device. I need to Send this streams over

  • 0

I captured video stream with Kinect device. I need to Send this streams over network. For this purpose I used sockets.
Her is piece of code in server and client:

private System.Drawing.Bitmap _CurrentBitmap;
    public ManWindow()
    {
        InitializeComponent();

        this.Loaded += delegate
        {
            BackgroundWorker bw1 = new BackgroundWorker();
            bw1.RunWorkerCompleted += (a, b) => bw1.RunWorkerAsync();
            bw1.DoWork += delegate { SendImage(); };
            bw1.RunWorkerAsync();
        };
    }
    public void SendImage()
    {
        Socket sListen = new Socket(AddressFamily.InterNetwork,
                                    SocketType.Stream,
                                    ProtocolType.Tcp);

        IPAddress IP = IPAddress.Parse("127.0.0.1");
        IPEndPoint IPE = new IPEndPoint(IP, 4321);

        sListen.Bind(IPE);
        sListen.Listen(2);

        while (true)
        {
            Socket clientSocket;
            clientSocket = sListen.Accept();

            var converter = new System.Drawing.ImageConverter();
            byte[] buffer = (byte[])converter.ConvertTo(_CurrentBitmap, typeof(byte[]));
            clientSocket.Send(buffer, buffer.Length, SocketFlags.None);
        }
    }

Client:

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        BackgroundWorker bw11111 = new BackgroundWorker();
        bw11111.RunWorkerCompleted += (a, b) => bw11111.RunWorkerAsync();
        bw11111.DoWork += delegate { Recive(); };
        bw11111.RunWorkerAsync();
        Recive();
    }

    public void Recive()
    {
        Socket s = new Socket(AddressFamily.InterNetwork,
                            SocketType.Stream,
                            ProtocolType.Tcp);

        IPAddress IP = IPAddress.Parse("127.0.0.1");
        IPEndPoint IPE = new IPEndPoint(IP, 4321);
        s.Connect(IPE);

        while (true)
        {

            byte[] buffer = new byte[1000000];

            s.Receive(buffer, buffer.Length, SocketFlags.None);

            MemoryStream ms = new MemoryStream(buffer);

            ms.Write(buffer, 0, buffer.Length);
            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(ms);

            Dispatcher.BeginInvoke(new Action(() =>
            {
                rgbImage11.Source = bitmap.ToBitmapSource();
            }));

        }
    }

_CurrentBitmap is frame that readed from Kinect and every 1 second updated. When Client starts, call Socket Receive method, it receives frame and after convert to bitmap asign it to Image WPF control. My problem is this action occurs ones and loop in client not repeated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:54:33+00:00Added an answer on June 9, 2026 at 5:54 am

    I think you are doing it right, although depending on your needs UDP sockets might make more sense.
    Try changing your Server code to something like this:

    while (true)
    {
         Socket clientSocket;
         clientSocket = sListen.Accept();
    
         var converter = new System.Drawing.ImageConverter();
         while(true) // find a better way to determine that the picture is still updating?
        {
            byte[] buffer = (byte[])converter.ConvertTo(_CurrentBitmap, typeof(byte[]));
            clientSocket.Send(buffer, buffer.Length, SocketFlags.None);
        }
    }
    

    You were sending one bitmap to your client, then falling out of the loop.
    The socket will not stay open, so your client runs it’s loop once.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create an application/driver in Windows that captures the video stream from
I'd like to stream video from the camera on an iOS device to a
I'm trying to stream a live video from a capture device via WCF. I
I am trying to decrypt the AES 128 bit Video stream from Iphone captured
I captured a video and took out a frame of that, converted it to
Basically I need to capture the video from videocamera do some processing on frames
I'm using JMF to capture video stream (webcam) on my Java project. The camera
I am looking for a usb based video capture card (to be used with
I have a video stream coming in on rtp to ffmpeg and I want
I'm using the AVFoundation classes to capture the live video stream from the camera

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.