Index: trunk/BNC/bnc.pro
===================================================================
--- trunk/BNC/bnc.pro	(revision 1499)
+++ trunk/BNC/bnc.pro	(revision 1500)
@@ -2,6 +2,6 @@
 # Switch to debug configuration
 # -----------------------------
-CONFIG -= debug
-CONFIG += release
+CONFIG -= release
+CONFIG += debug
 
 DEFINES += NO_RTCM3_MAIN 
Index: trunk/BNC/bncnetquery.h
===================================================================
--- trunk/BNC/bncnetquery.h	(revision 1499)
+++ trunk/BNC/bncnetquery.h	(revision 1500)
@@ -33,4 +33,5 @@
   queryStatus _status;
   int         _timeOut;
+  QUrl        _url;
 };
 
Index: trunk/BNC/bncnetqueryv1.cpp
===================================================================
--- trunk/BNC/bncnetqueryv1.cpp	(revision 1499)
+++ trunk/BNC/bncnetqueryv1.cpp	(revision 1500)
@@ -27,5 +27,6 @@
 ////////////////////////////////////////////////////////////////////////////
 bncNetQueryV1::bncNetQueryV1() {
-  _socket = 0;
+  _socket  = 0;
+  _timeOut = 20000;
 }
 
@@ -55,7 +56,18 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncNetQueryV1::waitForReadyRead(QByteArray& outData) {
-  if (_socket) {
-    if (_socket->waitForReadyRead()) {
-      outData = _socket->readAll();
+  if (_socket && _socket->state() == QAbstractSocket::ConnectedState) {
+    while (true) {
+      int nBytes = _socket->bytesAvailable();
+      if (nBytes > 0) {
+        outData = _socket->readAll();
+        return;
+      }
+      else if (!_socket->waitForReadyRead(_timeOut)) {
+        delete _socket;
+        _socket = 0;
+        _status = error;
+        emit newMessage(_url.path().toAscii() + " read timeout", true);
+        return;
+      }
     }
   }
@@ -66,6 +78,4 @@
 void bncNetQueryV1::startRequest(const QUrl& url, const QByteArray& gga) {
 
-  const int timeOut = 20000;
-
   _status = running;
 
@@ -75,10 +85,10 @@
   // Default scheme and path
   // -----------------------
-  QUrl urlLoc(url);
-  if (urlLoc.scheme().isEmpty()) {
-    urlLoc.setScheme("http");
+  _url = url;
+  if (_url.scheme().isEmpty()) {
+    _url.setScheme("http");
   }
-  if (urlLoc.path().isEmpty()) {
-    urlLoc.setPath("/");
+  if (_url.path().isEmpty()) {
+    _url.setPath("/");
   }
 
@@ -90,10 +100,10 @@
  
   if ( proxyHost.isEmpty() ) {
-    _socket->connectToHost(urlLoc.host(), urlLoc.port());
+    _socket->connectToHost(_url.host(), _url.port());
   }
   else {
     _socket->connectToHost(proxyHost, proxyPort);
   }
-  if (!_socket->waitForConnected(timeOut)) {
+  if (!_socket->waitForConnected(_timeOut)) {
     delete _socket; 
     _socket = 0;
@@ -104,6 +114,6 @@
   // Send Request
   // ------------
-  QString uName = QUrl::fromPercentEncoding(urlLoc.userName().toAscii());
-  QString passW = QUrl::fromPercentEncoding(urlLoc.password().toAscii());
+  QString uName = QUrl::fromPercentEncoding(_url.userName().toAscii());
+  QString passW = QUrl::fromPercentEncoding(_url.password().toAscii());
   QByteArray userAndPwd;
 
@@ -115,12 +125,12 @@
   QByteArray reqStr;
   if ( proxyHost.isEmpty() ) {
-    if (urlLoc.path().indexOf("/") != 0) urlLoc.setPath("/");
-    reqStr = "GET " + urlLoc.path().toAscii() + " HTTP/1.0\r\n"
+    if (_url.path().indexOf("/") != 0) _url.setPath("/");
+    reqStr = "GET " + _url.path().toAscii() + " HTTP/1.0\r\n"
              + "User-Agent: NTRIP BNC/" BNCVERSION "\r\n"
              + userAndPwd + "\r\n";
   } else {
-    reqStr = "GET " + urlLoc.toEncoded() + " HTTP/1.0\r\n"
+    reqStr = "GET " + _url.toEncoded() + " HTTP/1.0\r\n"
              + "User-Agent: NTRIP BNC/" BNCVERSION "\r\n"
-             + "Host: " + urlLoc.host().toAscii() + "\r\n"
+             + "Host: " + _url.host().toAscii() + "\r\n"
              + userAndPwd + "\r\n";
   }
@@ -134,9 +144,9 @@
   _socket->write(reqStr, reqStr.length());
 
-  if (!_socket->waitForBytesWritten(timeOut)) {
+  if (!_socket->waitForBytesWritten(_timeOut)) {
     delete _socket;
     _socket = 0;
     _status = error;
-    emit newMessage("bncnetqueryv1: write timeout", true);
+    emit newMessage(_url.path().toAscii() + " write timeout", true);
     return;
   }
@@ -145,14 +155,13 @@
   // --------------------
   while (true) {
-    if (!_socket->waitForReadyRead(timeOut)) {
+    if (!_socket->waitForReadyRead(_timeOut)) {
       delete _socket;
       _socket = 0;
       _status = error;
-      emit newMessage("bncnetqueryv1: read timeout", true);
+      emit newMessage(_url.path().toAscii() + " read timeout", true);
       return;
     }
     if (_socket->canReadLine()) {
       QString line = _socket->readLine();
-      cout << ">" << line.toAscii().data() << "<" << endl;
       if (line.indexOf("ICY 200 OK") != -1) {
         break;
