Can't send (or receive) data from socket
Hi,
I'm trying to get a jpeg file from a webserver using a Socket. Unfortunatly I always get an empty jpeg file :s
This is a piece of code where I save the received data:
try{
byte[] buff =newbyte[100000];
int bytesIn;
if (this.myClient.isConnected()){
// Send HTTP request.
this.out.print(this.requestString);
int offset = 0;
do{
bytesIn = this.in.read(buff, offset, 100);
offset += bytesIn;
}while (bytesIn > 0);
saveBytesToFile(buff,"test.jpg");
fos.close();
}
}catch (Exception e){
System.out.println(e.getMessage());
}
When I debug my code, the debugger just stops at "bytesIn = this.in.read(buff, offset, 100);", but the program keeps waiting for something...
Is there something wrong with the way I try to save everyting into the bytes array ?
Message was edited by:
ReggieBE

