Index: trunk/BNC/src/bncgetthread.cpp
===================================================================
--- trunk/BNC/src/bncgetthread.cpp	(revision 5645)
+++ trunk/BNC/src/bncgetthread.cpp	(revision 5646)
@@ -104,4 +104,5 @@
 
   bncSettings settings;
+
   if (!settings.value("rawOutFile").toString().isEmpty()) {
     _rawOutput = true;
@@ -131,4 +132,20 @@
   _miscMount     = settings.value("miscMount").toString();
   _decoder   = 0;
+
+  // Miscellaneous output port  // Georg
+  // -------------------------
+  _miscPort = settings.value("miscPort").toInt();
+  if (_miscPort != 0) {
+    _miscServer = new QTcpServer;
+    if ( !_miscServer->listen(QHostAddress::Any, _miscPort) ) {
+      emit newMessage("bncgetthread: Cannot listen on Miscellaneous Output Port", true);
+    }
+    connect(_miscServer, SIGNAL(newConnection()), this, SLOT(slotNewMiscConnection()));
+    _miscSockets = new QList<QTcpSocket*>;
+  }
+  else {
+    _miscServer  = 0;
+    _miscSockets = 0;
+  }
 
   // Serial Port
@@ -383,4 +400,6 @@
   delete _serialPort;
   delete _latencyChecker;
+  delete _miscServer;
+  delete _miscSockets;
   emit getThreadFinished(_staID);
 }
@@ -473,5 +492,24 @@
         _serialPort->write(data);
       }
-      
+
+      // Output into the Miscellaneous socket // Georg
+      // ------------------------------------
+      if (_miscSockets && _miscMount != "ALL") {
+        QMutableListIterator<QTcpSocket*> is(*_miscSockets);
+        while (is.hasNext()) {
+          QTcpSocket* sock = is.next();
+          if (sock->state() == QAbstractSocket::ConnectedState) {
+            if (myMiscWrite(sock, data, nBytes) != nBytes) {
+              delete sock;
+              is.remove();
+            }       
+          }       
+          else if (sock->state() != QAbstractSocket::ConnectingState) {
+            delete sock;
+            is.remove();
+          }       
+        }       
+      } 
+
       // Decode Data
       // -----------
@@ -671,4 +709,24 @@
 }
 
+// New Connection // Georg
+////////////////////////////////////////////////////////////////////////////
+void bncGetThread::slotNewMiscConnection() {
+  _miscSockets->push_back( _miscServer->nextPendingConnection() );
+  emit( newMessage(QString("New client connection on Miscellaneous Output Port: # %1")
+                   .arg(_miscSockets->size()).toAscii(), true) );
+}
+
+// Write buffer // Georg
+////////////////////////////////////////////////////////////////////////////
+int bncGetThread::myMiscWrite(QTcpSocket* sock, const char* buf, int bufLen) {
+  sock->write(buf, bufLen);
+  for (int ii = 1; ii <= 10; ii++) {
+    if (sock->waitForBytesWritten(10)) {  // wait 10 ms
+      return bufLen;
+    }
+  }
+  return -1;
+}
+
 // RTCM scan output
 //////////////////////////////////////////////////////////////////////////////
@@ -807,2 +865,3 @@
   }
 }
+
