Index: /trunk/BNC/bncnetqueryudp.cpp
===================================================================
--- /trunk/BNC/bncnetqueryudp.cpp	(revision 1760)
+++ /trunk/BNC/bncnetqueryudp.cpp	(revision 1761)
@@ -17,4 +17,5 @@
 #include <iostream>
 #include <iomanip>
+#include <time.h>
 
 #include "bncnetqueryudp.h"
@@ -24,4 +25,5 @@
 
 #define BNCVERSION "1.7"
+#define TIME_RESOLUTION 125
 
 // Constructor
@@ -32,15 +34,9 @@
   _eventLoop = new QEventLoop(this);
 
-  _keepAlive = new char[12];
-  _keepAlive[0]  = 128;
-  _keepAlive[1]  =  96;
-  for (int jj = 2; jj <= 7; jj++) {
-    _keepAlive[jj] = 0;
+  _keepAlive[ 0] = 128;
+  _keepAlive[ 1] =  96;
+  for (int ii = 2; ii <=11; ii++) {
+    _keepAlive[ii] = 0;
   }
-  int session = rand();
-  _keepAlive[8]  = (session >> 24) & 0xFF;
-  _keepAlive[9]  = (session >> 16) & 0xFF;
-  _keepAlive[10] = (session >>  8) & 0xFF;
-  _keepAlive[11] = (session)       & 0xFF;
 }
 
@@ -50,5 +46,4 @@
   delete _eventLoop;
   delete _udpSocket;
-  delete _keepAlive;
 }
 
@@ -64,8 +59,7 @@
 void bncNetQueryUdp::slotKeepAlive() {
   if (_udpSocket) {
-    cout << "slotKeepAlive" << endl;
     _udpSocket->writeDatagram(_keepAlive, 12, _address, _port);
   }
-  QTimer::singleShot(30000, this, SLOT(slotKeepAlive()));
+  QTimer::singleShot(15000, this, SLOT(slotKeepAlive()));
 }
 
@@ -156,5 +150,25 @@
 
     _udpSocket->writeDatagram(rtpbuffer, 12 + reqStr.size(), _address, _port);
-    QTimer::singleShot(30000, this, SLOT(slotKeepAlive()));
+
+    // 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/bncnetqueryudp.h
===================================================================
--- /trunk/BNC/bncnetqueryudp.h	(revision 1760)
+++ /trunk/BNC/bncnetqueryudp.h	(revision 1761)
@@ -23,5 +23,6 @@
   QHostAddress _address;
   int          _port;
-  char*        _keepAlive;
+  char         _keepAlive[12];
+  int          _session;
 };
 
Index: /trunk/BNC/todo.txt
===================================================================
--- /trunk/BNC/todo.txt	(revision 1760)
+++ /trunk/BNC/todo.txt	(revision 1761)
@@ -6,12 +6,8 @@
 BNC
 =========================
-(1) NTRIP "U": 
-Stopps after ~60sec with message "Data timeout, reconnecting"
-Could it be that a kind of keep-alife packet is necessary?
-
-(2) Added "bncnetquerys" for stream input from serial port
+(1) Added "bncnetquerys" for stream input from serial port
 Please have a look.
 
-(3) "Append" files doesn't work with "ZERO" decoder.
+(2) "Append" files doesn't work with "ZERO" decoder.
 
 (3) GW: Keep an eye on www.igs-ip.net/PENC0.
