Unable to read text file from server

Now for the "Real World" version. This has a timeout to prevent the while(client.connected()) loop from becoming an endless loop if the connection breaks or the server stalls.

  // connectLoop controls the hardware fail timeout
  int connectLoop = 0;

  while(client.connected())
  {
    while(client.available())
    {
      char ch= client.read();
      Serial.write(ch);
      // 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();