Error compiling Ethernet sketch

SurferTim:
Then, you should probably send a close connection after the host. If you send an HTTP/1.1 request, the server may not close that end unless you send that.

  client.println("Host: www.myserver.com");

client.println("Connection: close");
  client.println();

wouldn't the client.stop command achieve the same result as Connection: close ?

Anyway, as soon as I commented out the section starting with :

while(client.connected() && !client.available()) delay(1);

then everything worked as expected. I just can't figure out why the erratic behaviour before that.

You will do ok with that as long as you aren't sending much. You may have problems with multiple packets tho. I don't use that code.

Mine is more like this. This waits for the server to signal it is finished sending packets by closing the connection. This request should send the "Connection: close" parameter to insure the server does that. Otherwise, on multiple packet transmissions, you will need to determine when you have it all, or the network is slow, and the next packet hasn't gotten there yet.

while(client.connected())
{
   while(client.available())
   {
      char c = client.read();
      Serial.write(c);
   }
}

client.stop();

It is up to you which you use.

edit: My bad, I forgot the client.stop().