Index: /trunk/BNC/bncnetqueryudp0.cpp
===================================================================
--- /trunk/BNC/bncnetqueryudp0.cpp	(revision 1782)
+++ /trunk/BNC/bncnetqueryudp0.cpp	(revision 1783)
@@ -30,13 +30,5 @@
 ////////////////////////////////////////////////////////////////////////////
 bncNetQueryUdp0::bncNetQueryUdp0() {
-  _port      = 0;
   _udpSocket = 0;
-  _eventLoop = new QEventLoop(this);
-
-  _keepAlive[ 0] = 128;
-  _keepAlive[ 1] =  96;
-  for (int ii = 2; ii <=11; ii++) {
-    _keepAlive[ii] = 0;
-  }
 }
 
@@ -44,5 +36,4 @@
 ////////////////////////////////////////////////////////////////////////////
 bncNetQueryUdp0::~bncNetQueryUdp0() {
-  delete _eventLoop;
   delete _udpSocket;
 }
@@ -51,15 +42,10 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncNetQueryUdp0::stop() {
-  _eventLoop->quit();
+#ifndef sparc
+  if (_udpSocket) {
+    _udpSocket->abort();
+  }
+#endif
   _status = finished;
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp0::slotKeepAlive() {
-  if (_udpSocket) {
-    _udpSocket->writeDatagram(_keepAlive, 12, _address, _port);
-  }
-  QTimer::singleShot(15000, this, SLOT(slotKeepAlive()));
 }
 
@@ -72,19 +58,19 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncNetQueryUdp0::waitForReadyRead(QByteArray& outData) {
-
-  // Wait Loop
-  // ---------
-  if (!_udpSocket->hasPendingDatagrams()) {
-    _eventLoop->exec();
-  }
-
-  // Append Data
-  // -----------
-  QByteArray datagram;
-  datagram.resize(_udpSocket->pendingDatagramSize());
-  _udpSocket->readDatagram(datagram.data(), datagram.size());
-
-  if (datagram.size() > 12) {
-    outData.append(datagram.mid(12));
+  if (_udpSocket) {
+    while (true) {
+      int nBytes = _udpSocket->bytesAvailable();
+      if (nBytes > 0) {
+        outData = _udpSocket->readAll();
+        return;
+      }
+      else if (!_udpSocket->waitForReadyRead(_timeOut)) {
+        delete _udpSocket;
+        _udpSocket = 0;
+        _status = error;
+        emit newMessage(_url.path().toAscii() + " read timeout", true);
+        return;
+      }
+    }
   }
 }
@@ -92,5 +78,5 @@
 // Connect to Caster, send the Request
 ////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp0::startRequest(const QUrl& url, const QByteArray& gga) {
+void bncNetQueryUdp0::startRequest(const QUrl& url, const QByteArray& /* gga */) {
 
   _status = running;
@@ -106,70 +92,7 @@
   }
 
-  _port = _url.port();
-
   delete _udpSocket;
   _udpSocket = new QUdpSocket();
-  _udpSocket->bind(0);
-  connect(_udpSocket, SIGNAL(readyRead()), _eventLoop, SLOT(quit()));
-
-  QHostInfo hInfo = QHostInfo::fromName(url.host());
-
-  if (!hInfo.addresses().isEmpty()) {
-
-    _address = hInfo.addresses().first();
-
-    // Send Request
-    // ------------
-    QString uName = QUrl::fromPercentEncoding(_url.userName().toAscii());
-    QString passW = QUrl::fromPercentEncoding(_url.password().toAscii());
-    QByteArray userAndPwd;
-    
-    if(!uName.isEmpty() || !passW.isEmpty()) {
-      userAndPwd = "Authorization: Basic " + (uName.toAscii() + ":" +
-      passW.toAscii()).toBase64() + "\r\n";
-    }
-    
-    QByteArray reqStr = "GET " + _url.path().toAscii() + " HTTP/1.1\r\n"
-                      + "Host: " + _url.host().toAscii() + "\r\n"
-                      + "Ntrip-Version: Ntrip/2.0\r\n"
-                      + "User-Agent: NTRIP BNC/" BNCVERSION "\r\n";
-    if (!gga.isEmpty()) {
-      reqStr += "Ntrip-GGA: " + gga + "\r\n";
-    }
-    reqStr += userAndPwd + "Connection: close\r\n\r\n";
-    
-    char rtpbuffer[12 + reqStr.size()];
-    rtpbuffer[0]  = 128;
-    rtpbuffer[1]  =  97;
-    for (int jj = 2; jj <= 11; jj++) {
-      rtpbuffer[jj] = _keepAlive[jj];
-    }
-    for (int ii = 0; ii < reqStr.size(); ii++) {
-      rtpbuffer[12+ii] = reqStr[ii]; 
-    }
-
-    _udpSocket->writeDatagram(rtpbuffer, 12 + reqStr.size(), _address, _port);
-
-    // Wait for Reply, read Session Number
-    // -----------------------------------
-    QByteArray repl;
-    waitForReadyRead(repl);
-
-    QTextStream in(repl);
-    QString line = in.readLine();
-    while (!line.isEmpty()) {
-      if (line.indexOf("Session:") == 0) {
-        _session = line.mid(9).toInt();
-        _keepAlive[ 8] = (_session >> 24) & 0xFF;
-        _keepAlive[ 9] = (_session >> 16) & 0xFF;
-        _keepAlive[10] = (_session >>  8) & 0xFF;
-        _keepAlive[11] = (_session)       & 0xFF;
-        break;
-      }
-      line = in.readLine();
-    }
-
-    QTimer::singleShot(15000, this, SLOT(slotKeepAlive()));
-  }
+  _udpSocket->connectToHost(_url.host(), _url.port());
 }
 
Index: /trunk/BNC/bncnetqueryudp0.h
===================================================================
--- /trunk/BNC/bncnetqueryudp0.h	(revision 1782)
+++ /trunk/BNC/bncnetqueryudp0.h	(revision 1783)
@@ -14,15 +14,6 @@
   virtual void startRequest(const QUrl& url, const QByteArray& gga);
   virtual void waitForReadyRead(QByteArray& outData);
-
- private slots:
-  void slotKeepAlive();
-
  private:
   QUdpSocket*  _udpSocket;
-  QEventLoop*  _eventLoop;
-  QHostAddress _address;
-  int          _port;
-  char         _keepAlive[12];
-  int          _session;
 };
 
Index: /trunk/BNC/bncnetqueryv0.cpp
===================================================================
--- /trunk/BNC/bncnetqueryv0.cpp	(revision 1782)
+++ /trunk/BNC/bncnetqueryv0.cpp	(revision 1783)
@@ -77,8 +77,7 @@
 // Connect to Caster, send the Request
 ////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV0::startRequest(const QUrl& url, const QByteArray& gga) {
+void bncNetQueryV0::startRequest(const QUrl& url, const QByteArray& /* gga */) {
 
   _status = running;
-  QByteArray dummy = gga;
 
   delete _socket;
