Hello guys! i'm Russell and i need help on my android programming.
i'm using TCP and my android device is the client side. i am trying to transfer a picture over from my com to the android device and i keep getting errors.
on the computer i have a program that breaks up the image into bytes and sends it in packets . (yes i need to send it in packets. i need to do it that way. sadly haha)

ok here is my code

private void receivingImage(Message msg){


String value = msg.getData().getString("Sent Message");
byte[] readBuf = (byte[]) msg.obj;

receivedPacketCount++;
int messageLength = 0;

byte[] toSave = null;

if(msg.arg1 < sendTotalLength){

toSave = new byte[msg.arg1 - 4];

for(int i = 0 ; i < msg.arg1 - 4; i++){

toSave[i] = readBuf[i];

}
messageLength = msg.arg1;

}
else{


toSave = new byte[sendDataLength];

for(int i = 0 ; i < sendDataLength; i++){

toSave[i] = readBuf[i];

}
messageLength = sendTotalLength;
}

byte[] countByte = new byte[4];

String value1 = "";

//to convert from little endian to big endian format - working on HTC Desire
for(int i=0; i < 4; i++){
Log.d("Count value", "i : " + i + " : msg - " + readBuf[messageLength-i-1]);
countByte[i] = readBuf[messageLength-i-1];
value1 += readBuf[messageLength-i-1];

}

int packCount = readIntFromByteArray(countByte);

Log.d(TAG, "message ("+toSave.length+") - : " + packCount + " : " + value1);

try{
data.set(packCount, toSave);
}
catch(Exception e){

Log.d(TAG, "error message : " + e.getMessage());

}

requestForNextPortion(packCount+1);

}



help needed thanks a bunch
and i hope this is the correct forum