+        // peek at the socket to see if there is a CRLF
+        sock->Peek(pBuf, LINE_BUF);
+
+        size_t nRead = sock->LastCount();
+        if ( !nRead && sock->Error() )
+            return wxPROTO_NETERR;
+
+        // look for "\r\n" paying attention to a special case: "\r\n" could
+        // have been split by buffer boundary, so check also for \r at the end
+        // of the last chunk and \n at the beginning of this one
+        pBuf[nRead] = '\0';
+        const char *eol = strchr(pBuf, '\n');
+
+        // if we found '\n', is there a '\r' as well?
+        if ( eol )