   // Bind the socket to an iostream
   IOStream page(sock);
   INET::addr_t addr;
-  char buf[32];
+  char buf[64];
   int res;
 
   // Get client connection information; MAC, IP address and port
   sock->get_src(addr);
 
   // Wait for the HTTP request
-  while ((res = sock->available()) == 0);
+  while ((res = sock->available()) == 0) Watchdog::delay(32);
   if (res < 0) goto error;
-  TRACE(sock->available());
 
-#ifndef NDEBUG
-  // Read request and print in debug mode. Ignore contents
-  trace << PSTR("Request#") << nr << endl;
-  while ((res = sock->recv(buf, sizeof(buf) - 1)) > 0) {
-    buf[res] = 0;
-    trace << buf;
-  }
-  trace << endl;
-#endif
+  // Read request and print contents
+  sock->gets(buf, sizeof(buf));
+  trace << uptime << ':' << nr << ':' << buf << endl;
 
   // Reply page; header and footer are static, contents dynamic
   static const char header[] PROGMEM = 

W5100 ethernet(mac);
Socket* sock;

// Debugging mode; trace print
#define NDEBUG
#ifdef NDEBUG
#undef TRACE
#define TRACE(x) x
#endif

// HTML end of line
#define CRLF "\r\n"


  setup_free_memory = free_memory();

  uart.begin(9600);
  trace.begin(&uart, PSTR("CosaWebServer: started"));
  Watchdog::begin();

  // Initiate ethernet controller with address
