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

  • SEARCH
  • Home
  • 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 6349975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:43:22+00:00 2026-05-24T21:43:22+00:00

I am trying to Send the image to the Client which is connected to

  • 0

I am trying to Send the image to the Client which is connected to my TCP Listner (Server). I am successfully sending and receiving text over Network but I am unable to send the picture to the client from my server. I want to Dislpay the picture in PictureBox placed in the Client Window.
Here is a Code I am using to Send and Receive text BUT NOT PICTURE

SERVER:

RECEIVER:

void TListner()
    {
        try
        {
            IPEndPoint ipendp = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8080);
            TcpListener tl = new TcpListener(ipendp);
            tl.Start();
            Socket s1 = tl.AcceptSocket(); ;
            NetworkStream ns = new NetworkStream(s1);
            StreamReader sr = new StreamReader(ns);

            while (true)
            {
                    textBox1.Text = sr.ReadLine();
            }
        }
        catch
        {
            Application.Exit();
        }

    }

SENDER:

        MemoryStream ms = new MemoryStream();
        sw.Write("TEST STRING");
        sw.Flush();

CLIENT:

RECEIVER:

    void TCP_CLIENT()
    {
        try
        {
            IPEndPoint ipendp = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8080);
            TcpClient tcpc = new TcpClient();
            tcpc.Connect(ipendp);
            NetworkStream ns = tcpc.GetStream();
            StreamReader sr = new StreamReader(ns);
            while (true)
            {
                textBox1.Text = sr.ReadLine();
            }
        }
        catch
        {
            Application.Exit();
        }

I want to display the picture in a PictureBox named PBox1 in Client Window.

  • 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-05-24T21:43:25+00:00Added an answer on May 24, 2026 at 9:43 pm

    You’re find to send and receive text because you’re using StreamReader and StreamWriter. Those deal with text. You haven’t actually shown the code you’re trying to use for sending pictures, but fundamentally you mustn’t use Reader/Writer unless you’re performing some sort of extra encoding first (e.g. base64).

    Also, unless you’re going to close the writing socket immediately after sending, you should probably write the data length (e.g. as 4 bytes) before the data so that the receiving socket knows how much it needs to receive.

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

Sidebar

Related Questions

I am trying to send an image over UDP using JAVA. I have managed
Hey, I'm currently trying to send an image file to a web server using
Im trying to send multiple data items over a tcp socket from an android
I'm trying to send an image using a Java server to my Android device
I'm trying to send an image to a server, using HTTP Post Multipart. Everything
I am trying to send over a variable which contains id of a user
I'm trying to send an image as a Base64 encoded string to my PHP
I am trying to send an image from a Java desktop application to a
I am trying to send a faceless email (sending an email without showing the
I'm trying to send a single image from my iPhone app to my Google

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.