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 9188943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:08:01+00:00 2026-06-17T20:08:01+00:00

Ive tried several solutions Ive found on the internet on how to send multipleimages

  • 0

Ive tried several solutions Ive found on the internet on how to send multipleimages over a socket, but I cant get it to work as I want. I have the following setup:

Client:

  1. A thread taking snapshots of my screen and putting them in a queue
  2. Several threads reading from the queue and sending the images over a socket to a server

Server:

  1. A socket server that allows multiple connections and receives the image and put them in a queue
  2. A thread that reads the queue and writes the images to a JPanel

My problem is that Im having a hard time to send the images over the socket, eg. keeping an open socket and just stream the images. I’ve tried different solutions, but only the first images are sent. If someone could share some code on how to write multiple images from one thread to another I would be very grateful.

Edit

It feels like each image is not flushed? I now create 1 thread to send with an open connection:

while(true)
{
  BufferedImage imageQItem = (BufferedImage) queue.dequeue();
  ImageIO.write(imageQItem,"jpg",out);//out is a dataoutputstream
}

And I then read it in (my socket server creates a new thread for the connection of the above client)

while(true)
{
  System.out.println("Reading");
  BufferedImage image = ImageIO.read(in);
  viewer.setBufferedImage(image);
  viewer.repaint();
}

All that happens is that it keeps printing reading. I don’t seem to get an end to each image.

  • 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-17T20:08:02+00:00Added an answer on June 17, 2026 at 8:08 pm

    Send (and receive) each image as a byte[], and preferably use a file format that compresses images, like .jpg. Don’t forget to flush() the stream between images. And make sure to read all the bytes of an image before trying to read the next one.

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

Sidebar

Related Questions

test image here: http://images.plurk.com/tn_4134189_bf54fe8e270ce41240d534b5133884ee.gif I've tried several solutions found on the internet but there
I've tried several of the solutions that I've found here, but none seem to
I've tried several ways to get this to render correctly. I want my logo
I've tried several times to get grep or sed to do what I want
I've tried applying several suggestions found on the web, but still experiencing cached results
I've tried several solutions found, like the one -> http://www.pcreview.co.uk/forums/console-writeline-hangs-if-user-click-into-console-window-t1412701.html But, I observed that
I've looked and found several similar questions but can't seem to make the solutions
I've got a very strange problem and tried several solutions found in the www,
I'm trying to create an image containing text. I've tried several examples I've found
Ive tried to hunt down the tutorial for notepad on android developers but it

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.