Index: /trunk/BNC/bncgetthread.cpp
===================================================================
--- /trunk/BNC/bncgetthread.cpp	(revision 1376)
+++ /trunk/BNC/bncgetthread.cpp	(revision 1377)
@@ -54,5 +54,5 @@
 #include "bncrinex.h"
 #include "bnczerodecoder.h"
-#include "bncsocket.h"
+#include "bncnetquery.h"
 
 #include "RTCM/RTCM2Decoder.h"
@@ -120,5 +120,5 @@
 
   _decoder    = 0;
-  _socket     = 0;
+  _query      = 0;
   _timeOut    = 20*1000; // 20 seconds
   _nextSleep  = 1;       //  1 second
@@ -288,11 +288,6 @@
 ////////////////////////////////////////////////////////////////////////////
 bncGetThread::~bncGetThread() {
-  if (_socket) {
-    _socket->close();
-#if QT_VERSION == 0x040203
-    delete _socket;
-#else
-    _socket->deleteLater();
-#endif
+  if (_query) {
+    _query->deleteLater();
   }
   delete _decoder;
@@ -308,92 +303,7 @@
 
   if (!_rawInpFile) {
-
-    // Initialize Socket
-    // -----------------
-    QString msg;
-    delete _socket;
-    _socket = new bncSocket;
-    if (_socket->request(_mountPoint, _latitude, _longitude, 
-                         _nmea, _ntripVersion, _timeOut, msg) != success) {
-      delete _socket;
-      _socket = 0;
-      return failure;
-    }
-    
-    // Read Caster Response
-    // --------------------
-    if (_ntripVersion == "1") {
-      _socket->waitForReadyRead(_timeOut);
-      if (_socket->canReadLine()) {
-        QString line = _socket->readLine();
-      
-        // Skip messages from proxy server
-        // -------------------------------
-        if (line.indexOf("ICY 200 OK") == -1 && 
-            line.indexOf("200 OK")     != -1 ) {
-          bool proxyRespond = true;
-          while (true) {
-            if (_socket->canReadLine()) {
-              line = _socket->readLine();
-              if (!proxyRespond) {
-                break;
-              }
-              if (line.trimmed().isEmpty()) {
-                proxyRespond = false;
-              }
-            }
-            else {
-              _socket->waitForReadyRead(_timeOut);
-              if (_socket->bytesAvailable() <= 0) {
-                break;
-              }
-            }
-          }
-        }
-      
-        if (line.indexOf("Unauthorized") != -1) {
-          QStringList table;
-          bncTableDlg::getFullTable(_mountPoint.host(), _mountPoint.port(), 
-                                    table);
-          QString net;
-          QStringListIterator it(table);
-          while (it.hasNext()) {
-            QString line = it.next();
-            if (line.indexOf("STR") == 0) {
-              QStringList tags = line.split(";");
-              if (tags.at(1) == _staID_orig) {
-                net = tags.at(7);
-                break;
-              }
-            }
-          }
-      
-          QString reg;
-          it.toFront();
-          while (it.hasNext()) {
-            QString line = it.next();
-            if (line.indexOf("NET") == 0) {
-              QStringList tags = line.split(";");
-              if (tags.at(1) == net) {
-                reg = tags.at(7);
-                break;
-              }          
-            }
-          }
-          emit(newMessage((_staID + ": Caster Response: " + line + 
-                           "          Adjust User-ID and Password Register, see"
-                           "\n          " + reg).toAscii(), true));
-          return fatal;
-        }
-        if (line.indexOf("ICY 200 OK") != 0) {
-          emit(newMessage((_staID + ": Wrong Caster Response:\n" + line).toAscii(), true));
-          return failure;
-        }
-      }
-      else {
-        emit(newMessage(_staID + ": Response Timeout", true));
-        return failure;
-      }
-    }
+    delete _query;
+    _query = new bncNetQuery();
+    _query->startRequest(_mountPoint);
   }
 
@@ -487,6 +397,6 @@
   while (true) {
     try {
-      if (_socket && _socket->state() != QAbstractSocket::ConnectedState) {
-        emit(newMessage(_staID + ": Socket not connected, reconnecting", true));
+      if (_query && _query->status() != bncNetQuery::running) {
+        emit(newMessage(_staID + ": Internet query not running, reconnecting", true));
         tryReconnect();
       }
@@ -500,7 +410,9 @@
       qint64 nBytes = 0;
 
-      if      (_socket) {
-        _socket->waitForReadyRead(_timeOut);
-        nBytes = _socket->bytesAvailable();
+      QByteArray data;
+
+      if      (_query) {
+        _query->waitForReadyRead(data);
+        nBytes = data.size();
       }
       else if (_rawInpFile) {
@@ -512,10 +424,5 @@
         emit newBytes(_staID, nBytes);
 
-        QByteArray data;
-
-        if (_socket) {
-          data = _socket->read(nBytes);
-        }
-        else if (_rawInpFile) {
+        if (_rawInpFile) {
           data = _rawInpFile->read(nBytes);
           if (data.isEmpty()) {
@@ -532,5 +439,4 @@
         if (_serialPort) {
           _serialPort->write(data);
-	  ////          _serialPort->flush();
         }
 
Index: /trunk/BNC/bncgetthread.h
===================================================================
--- /trunk/BNC/bncgetthread.h	(revision 1376)
+++ /trunk/BNC/bncgetthread.h	(revision 1377)
@@ -37,5 +37,5 @@
 class bncRinex;
 class QextSerialPort;
-class bncSocket;
+class bncNetQuery;
 
 class bncGetThread : public QThread {
@@ -79,5 +79,5 @@
    void  callScript(const char* _comment);
    GPSDecoder* _decoder;
-   bncSocket*  _socket;
+   bncNetQuery* _query;
    QUrl        _mountPoint;
    QByteArray  _staID;
