473,320 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

sending jpg image from pc to android using sockets

I am trying to send the screenshots of the pc(java server) to android(client) using sockets. I am not able to do this task.

Well, also I have successfully send the screenshots from pc(java server) to pc(java client) using sockets. Server is using ImageIO which converts the image into byte array which i sent using sockets and the the client is again using the ImageIO to convert that fetched byte array into a bufferedImage.

But unfortunately Android does not support ImageIO. It supports some BitmapFactory class. I am not able to work it out. And hence i am not able to transfer image from java server to android client. Need help..plz.
Mar 31 '13 #1
1 3548
Nepomuk
3,112 Expert 2GB
Never having done this myself, I have to guess about a few points; in general however, the BitmapFactory class looks promising. There are two ways I would try to accomplish this task:
1. Get the network stream and hand it to the decodeStream function with something like this:
Expand|Select|Wrap|Line Numbers
  1. InputStream myInput = ...;
  2. Bitmap screenshot = BitmapFactory.decodeStream(myInput);
2. Save the bytes into an array and hand that to BitmapFactory.decodeByteArray(), a bit like the following:
Expand|Select|Wrap|Line Numbers
  1. byte[] myInputArray = ...;
  2. Bitmap screenshot = BitmapFactory.decodeByteArray(myInputArray, 0, myInputArray.length());
Does that help? If not, can you show us what you've tried so far and tell us, what exactly doesn't work about those attempts?
Apr 29 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Google Mike | last post by:
Using Sockets (fsockopen, fputs, fgets, etc.) I'm able to interact with an SMTP server to send mail. However, do you know the steps necessary in order to send a file attachment as well? (Note,...
2
by: Vinod | last post by:
All, .NET Web Service needs to talk to third party software through TCP/IP sockets. Do we have any .Net Framework in place which can do a TCP/IP
9
by: Mike Curry | last post by:
I am looking for a simple sample of using sockets to download a page into a string. If anyone knows where I could get a sample, or post one here, that would be great.
7
by: sareel | last post by:
I need the explanation/code to transmit a complex datastructure like Linked list or binary tree using sockets from client to sever...
6
by: Lorenzo Thurman | last post by:
Does anyone know how to validate a particular image type using PHP? If I have a file and I want to ensure that it is a jpeg, how would go about it? A sort of is_jpeg or is_gif is what I'm seeking....
3
by: ahmed.maryam | last post by:
Hi all, I have a weird situation here in that I've designed two C# applications that need to communicate with each other using sockets. So I am trying to set the applications up in a way that...
3
by: prognoob | last post by:
I need help coding a file transfer in C#. It would be over TCP/IP using sockets... most of the solutions i have come across, they use networkstream and i have read online that there is no need to...
2
yashg
by: yashg | last post by:
I am building a data backup application in C# using Sockets. It has a server component and a client component. The client is going to upload files to the server through TCP sockets. I've got all...
0
by: avinashibs | last post by:
Hi, i want to receive mail from my mail server through vb.net using sockets, could any one please help me with code. it's very urgent requirement for me. Thanks,
0
by: toto1980 | last post by:
Hi; I tried look for a simple way of sending a file using sockets, I found one in the old forums but I am not sure why the file when it is sent, the client side some how receive wrong contents, and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.