The server closes the connection. If your server is not closing the connection, you need to timeout the connection on the client end. Here is what I use on the client to timeout a broken connection or stalled server.
// connectLoop controls the hardware fail timeout
int connectLoop = 0;
while(client.connected())
{
while(client.available())
{
inChar = client.read();
Serial.write(inChar);
// set connectLoop to zero if a packet arrives
connectLoop = 0;
}
connectLoop++;
// if more than 10000 milliseconds since the last packet
if(connectLoop > 10000)
{
// then close the connection from this end.
Serial.println();
Serial.println(F("Timeout"));
client.stop();
}
// this is a delay for the connectLoop timing
delay(1);
}
Serial.println();
Serial.println(F("disconnecting."));
// close client end
client.stop();
The full code I use is here.
http://playground.arduino.cc/Code/WebClient
edit: You didn't answer my main question. What kind of device is 192.168.0.102? LAMP server? Windows? Arduino?