Index: trunk/BNC/bncnetqueryudp.cpp
===================================================================
--- trunk/BNC/bncnetqueryudp.cpp	(revision 1718)
+++ trunk/BNC/bncnetqueryudp.cpp	(revision 1719)
@@ -28,4 +28,5 @@
 ////////////////////////////////////////////////////////////////////////////
 bncNetQueryUdp::bncNetQueryUdp() {
+  _port      = 0;
   _udpSocket = 0;
   _eventLoop = new QEventLoop(this);
@@ -83,34 +84,66 @@
   _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()));
-  QByteArray clientPort = QString("%1").arg(_udpSocket->localPort()).toAscii();
-
-  // Send initial RTP packet for firewall handling
-  // ---------------------------------------------
-  char rtpbuffer[12];
-  rtpbuffer[0]  = (2<<6);
-  rtpbuffer[1]  = 96;
-  rtpbuffer[2]  = 0;
-  rtpbuffer[3]  = 0;
-  rtpbuffer[4]  = 0;
-  rtpbuffer[5]  = 0;
-  rtpbuffer[6]  = 0;
-  rtpbuffer[7]  = 0;
-  rtpbuffer[8]  = 0;
-  rtpbuffer[9]  = 0; 
-  rtpbuffer[10] = 0;
-  rtpbuffer[11] = 0;
 
   QHostInfo hInfo = QHostInfo::fromName(url.host());
 
-  QHostAddress address;
   if (!hInfo.addresses().isEmpty()) {
-    address = hInfo.addresses().first();
-    _udpSocket->writeDatagram(rtpbuffer, 12, address, url.port());
+
+    _address = hInfo.addresses().first();
+
+    // Send initial RTP packet for firewall handling
+    // ---------------------------------------------
+    char rtpbuffer[12];
+    rtpbuffer[0]  = (2<<6);
+    rtpbuffer[1]  = 96;
+    rtpbuffer[2]  = 0;
+    rtpbuffer[3]  = 0;
+    rtpbuffer[4]  = 0;
+    rtpbuffer[5]  = 0;
+    rtpbuffer[6]  = 0;
+    rtpbuffer[7]  = 0;
+    rtpbuffer[8]  = 0;
+    rtpbuffer[9]  = 0; 
+    rtpbuffer[10] = 0;
+    rtpbuffer[11] = 0;
+
+    _udpSocket->writeDatagram(rtpbuffer, 12, _address, _port);
+
+    // 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.0\r\n"
+                      + "User-Agent: NTRIP BNC/" BNCVERSION "\r\n"
+                      + userAndPwd + "\r\n";
+    
+    // NMEA string to handle VRS stream
+    // --------------------------------
+    if (!gga.isEmpty()) {
+      reqStr += gga + "\r\n";
+    }
+
   }
-
 }
 
