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.
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.
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):
Code:output = new DataOutputStream(socket.getOutputStream ());
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
}...