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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:51:10+00:00 2026-05-19T09:51:10+00:00

I am trying to transfer images quickly between my Android phone and my PC

  • 0

I am trying to transfer images quickly between my Android phone and my PC over wifi. I have written code to do this but it can 4-5 seconds to transfer one 640x480px image across. I am wondering is my method flawed and is there a faster way to do this?

Here is the Server code

void main(String[] args)
{
        try {
             ServerSocket serverSocket = new ServerSocket(5555);
             Socket clientSocket = serverSocket.accept();

             long startTime = System.currentTimeMillis();
             InputStream clientInputStream = clientSocket.getInputStream();
             BufferedImage BI = ImageIO.read(clientInputStream);
             long endTime = System.currentTimeMillis();
             ImageIO.write(BI,"png",new File("test.png"));
             System.out.println((endTime - startTime) + " ms.");

             } catch (IOException e) 
             {
                e.printStackTrace();
             }     
}
}

Here is the Android client code

public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Bitmap imageToSend = BitmapFactory.decodeResource(this.getResources(),R.drawable.img);

    try 
    {
        Socket socket = new Socket("192.168.1.1",5555);         
        imageToSend.compress(CompressFormat.PNG,0 , socket.getOutputStream());          
    }        
    catch (Exception e) {
        e.printStackTrace();
    }
}

Thank you for any help you can give.

  • 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-19T09:51:11+00:00Added an answer on May 19, 2026 at 9:51 am

    Two things I can think of:

    • Use a buffered output stream in your output e.g.

      new BufferedOutputStream(socket.getOutputStream());

    • Write the image to disk first. Then try to open sockets in parallel each transferring a different offset of the image (e.g. split the image to 3 jobs, transfer each in parallel to the others). This will workaround some TCP behaviors.

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

Sidebar

Related Questions

I have a scripted SQL Server Agent job I'm trying to transfer over to
Im trying to create file transfer service over WCF, but i got some problems
I'm trying to transfer the contents of one list to another, but it's not
I have be trying to figure out what is wrong but every time i
Ultimately I'm trying to transfer buffers from one machine to another. The code below
I have an issue where I'm trying to transfer a large number of objects
I am trying to transfer an image using TCP sockets using linux. I have
I'm trying to securely transfer files between 2 devices, so I'm using an SslStream
Im trying to transfer a string-variable to another page. In Main Page code looks
I have been trying to send .png images from iPhone to web service. I

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.