Results 1 to 2 of 2
- 10-07-2009, 12:39 PM #1
Member
- Join Date
- Feb 2009
- Posts
- 50
- Rep Power
- 0
socket commuication taking 3 minutes to send 512x512 bmp image
i want to convert an bmp image size of 512x512.bmp into byte[] so that I can send it over a Socket.my problem is sending over a socket is taking 3 minutes.i have used getInputStream and getOutputStream.
Any help will be greatly appreciated.
- 10-07-2009, 04:42 PM #2
Are you sending a byte per packet? Or are you sending it in larger chunks?
Edit: this is how i send data on one of my connections (not sure if it helps):
Java Code:output = new DataOutputStream(socket.getOutputStream ());
Java Code:... byte[] len = new byte[]{ 0, (byte)(b.length >> 16 & 0xff), (byte)(b.length >> 8 & 0xff), (byte)(b.length & 0xff) }; synchronized(output) { //send out data size output.writeByte(len[1]); //1 byte output.writeByte(len[2]); //1 byte output.writeByte(len[3]); //1 byte //send data output.write(b,0,b.length); // n bytes }...Last edited by mrmatt1111; 10-07-2009 at 05:08 PM.
My Hobby Project: LegacyClone
Similar Threads
-
socket communication taking 4 minutes to transfer 1mbytes to client
By santhosh_el in forum NetworkingReplies: 5Last Post: 11-01-2009, 05:16 PM -
How to send folder through a connected socket
By Chris555 in forum NetworkingReplies: 0Last Post: 07-18-2009, 11:41 AM -
Server socket - send image to client
By Hinty in forum NetworkingReplies: 2Last Post: 03-14-2009, 07:39 AM -
Send an array via Socket
By lene in forum NetworkingReplies: 0Last Post: 04-23-2008, 04:29 PM -
send files through socket
By bbq in forum Advanced JavaReplies: 1Last Post: 06-05-2007, 02:08 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks