Index: trunk/BNC/bnc.pro
===================================================================
--- trunk/BNC/bnc.pro	(revision 1778)
+++ trunk/BNC/bnc.pro	(revision 1779)
@@ -32,4 +32,5 @@
           bncnetqueryrtp.h bncsettings.h latencychecker.h             \
           bncipport.h bncnetqueryv0.h bncnetqueryudp.h                \ 
+          bncnetqueryudp0.h                                           \ 
           bncserialport.h bncnetquerys.h                              \ 
           RTCM/GPSDecoder.h RTCM/RTCM2.h RTCM/RTCM2Decoder.h          \
@@ -53,4 +54,5 @@
           bncnetqueryrtp.cpp bncsettings.cpp latencychecker.cpp       \
           bncipport.cpp bncnetqueryv0.cpp bncnetqueryudp.cpp          \
+          bncnetqueryudp0.cpp                                         \
           bncserialport.cpp bncnetquerys.cpp                          \
           RTCM/RTCM2.cpp RTCM/RTCM2Decoder.cpp                        \
Index: trunk/BNC/bncgetthread.cpp
===================================================================
--- trunk/BNC/bncgetthread.cpp	(revision 1778)
+++ trunk/BNC/bncgetthread.cpp	(revision 1779)
@@ -59,4 +59,5 @@
 #include "bncnetqueryrtp.h"
 #include "bncnetqueryudp.h"
+#include "bncnetqueryudp0.h"
 #include "bncnetquerys.h"
 #include "bncsettings.h"
@@ -520,4 +521,7 @@
       _query = new bncNetQueryV0();
     }
+    else if (_ntripVersion == "UN") {
+      _query = new bncNetQueryUdp0();
+    }
     else if (_ntripVersion == "2") {
       _query = new bncNetQueryV2();
Index: trunk/BNC/bncnetqueryudp0.cpp
===================================================================
--- trunk/BNC/bncnetqueryudp0.cpp	(revision 1779)
+++ trunk/BNC/bncnetqueryudp0.cpp	(revision 1779)
@@ -0,0 +1,175 @@
+/* -------------------------------------------------------------------------
+ * BKG NTRIP Client
+ * -------------------------------------------------------------------------
+ *
+ * Class:      bncNetQueryUdp0
+ *
+ * Purpose:    Blocking Network Requests (plain UDP, no NTRIP)
+ *
+ * Author:     L. Mervart
+ *
+ * Created:    04-Feb-2009
+ *
+ * Changes:    
+ *
+ * -----------------------------------------------------------------------*/
+
+#include <iostream>
+#include <iomanip>
+#include <time.h>
+
+#include "bncnetqueryudp0.h"
+#include "bncsettings.h"
+
+using namespace std;
+
+#define BNCVERSION "1.7"
+#define TIME_RESOLUTION 125
+
+// Constructor
+////////////////////////////////////////////////////////////////////////////
+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;
+  }
+}
+
+// Destructor
+////////////////////////////////////////////////////////////////////////////
+bncNetQueryUdp0::~bncNetQueryUdp0() {
+  delete _eventLoop;
+  delete _udpSocket;
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncNetQueryUdp0::stop() {
+  _eventLoop->quit();
+  _status = finished;
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncNetQueryUdp0::slotKeepAlive() {
+  if (_udpSocket) {
+    _udpSocket->writeDatagram(_keepAlive, 12, _address, _port);
+  }
+  QTimer::singleShot(15000, this, SLOT(slotKeepAlive()));
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncNetQueryUdp0::waitForRequestResult(const QUrl&, QByteArray&) {
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+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));
+  }
+}
+
+// Connect to Caster, send the Request
+////////////////////////////////////////////////////////////////////////////
+void bncNetQueryUdp0::startRequest(const QUrl& url, const QByteArray& gga) {
+
+  _status = running;
+
+  // Default scheme and path
+  // -----------------------
+  _url = url;
+  if (_url.scheme().isEmpty()) {
+    _url.setScheme("http");
+  }
+  if (_url.path().isEmpty()) {
+    _url.setPath("/");
+  }
+
+  _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()));
+  }
+}
+
Index: trunk/BNC/bncnetqueryudp0.h
===================================================================
--- trunk/BNC/bncnetqueryudp0.h	(revision 1779)
+++ trunk/BNC/bncnetqueryudp0.h	(revision 1779)
@@ -0,0 +1,29 @@
+#ifndef BNCNETQUERYUDP0_H
+#define BNCNETQUERYUDP0_H
+
+#include "bncnetquery.h"
+
+class bncNetQueryUdp0 : public bncNetQuery {
+ Q_OBJECT
+ public:
+  bncNetQueryUdp0();
+  virtual ~bncNetQueryUdp0();
+
+  virtual void stop();
+  virtual void waitForRequestResult(const QUrl& url, QByteArray& outData);
+  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;
+};
+
+#endif
