Index: /trunk/BNC/src/bnccaster.cpp
===================================================================
--- /trunk/BNC/src/bnccaster.cpp	(revision 5646)
+++ /trunk/BNC/src/bnccaster.cpp	(revision 5647)
@@ -129,4 +129,21 @@
   }
 #endif
+
+  // Miscellaneous output port  // Georg
+  // -------------------------
+  _miscMount = settings.value("miscMount").toString();
+  _miscPort  = settings.value("miscPort").toInt();
+  if (!_miscMount.isEmpty() && _miscPort != 0) {
+    _miscServer = new QTcpServer;
+    if ( !_miscServer->listen(QHostAddress::Any, _miscPort) ) {
+      emit newMessage("bncCaster: Cannot listen on Miscellaneous Output Port", true);
+    }
+    connect(_miscServer, SIGNAL(newConnection()), this, SLOT(slotNewMiscConnection()));
+    _miscSockets = new QList<QTcpSocket*>;
+  }
+  else {
+    _miscServer  = 0;
+    _miscSockets = 0;
+  }
 }
 
@@ -157,4 +174,6 @@
   }
 #endif
+  delete _miscServer;
+  delete _miscSockets;
 }
 
@@ -579,2 +598,42 @@
 }
 
+//      // 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();
+//          }       
+//        }       
+//      } 
+
+
+// New Connection // Georg
+////////////////////////////////////////////////////////////////////////////
+void bncCaster::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 bncCaster::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;
+}
+
Index: /trunk/BNC/src/bnccaster.h
===================================================================
--- /trunk/BNC/src/bnccaster.h	(revision 5646)
+++ /trunk/BNC/src/bnccaster.h	(revision 5647)
@@ -50,4 +50,5 @@
    void slotNewObs(QByteArray staID, QList<t_obs> obsList);
    void slotNewNMEAstr(QByteArray str);
+   void slotNewMiscConnection();
 
  signals:
@@ -66,4 +67,5 @@
    void dumpEpochs(long minTime, long maxTime);
    static int myWrite(QTcpSocket* sock, const char* buf, int bufLen);
+   static int myMiscWrite(QTcpSocket* sock, const char* buf, int bufLen);
    void reopenOutFile();
 
@@ -85,4 +87,8 @@
    QMutex                   _mutex;
    int                      _confInterval;
+   QString                  _miscMount;
+   int                      _miscPort;
+   QTcpServer*              _miscServer;
+   QList<QTcpSocket*>*      _miscSockets;
 #ifdef RTROVER_INTERFACE
    t_bncRtrover*            _bncRtrover;
Index: /trunk/BNC/src/bncgetthread.cpp
===================================================================
--- /trunk/BNC/src/bncgetthread.cpp	(revision 5646)
+++ /trunk/BNC/src/bncgetthread.cpp	(revision 5647)
@@ -104,5 +104,4 @@
 
   bncSettings settings;
-
   if (!settings.value("rawOutFile").toString().isEmpty()) {
     _rawOutput = true;
@@ -132,20 +131,4 @@
   _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
@@ -400,6 +383,4 @@
   delete _serialPort;
   delete _latencyChecker;
-  delete _miscServer;
-  delete _miscSockets;
   emit getThreadFinished(_staID);
 }
@@ -492,24 +473,5 @@
         _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
       // -----------
@@ -709,24 +671,4 @@
 }
 
-// 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
 //////////////////////////////////////////////////////////////////////////////
@@ -865,3 +807,2 @@
   }
 }
-
Index: /trunk/BNC/src/bncgetthread.h
===================================================================
--- /trunk/BNC/src/bncgetthread.h	(revision 5646)
+++ /trunk/BNC/src/bncgetthread.h	(revision 5647)
@@ -92,8 +92,6 @@
  private slots:
    void slotSerialReadyRead();
-   void slotNewMiscConnection();
 
  private:
-   static int myMiscWrite(QTcpSocket* sock, const char* buf, int bufLen);
    enum t_serialNMEA {NO_NMEA, MANUAL_NMEA, AUTO_NMEA};
    t_irc        initDecoder();
@@ -117,5 +115,4 @@
    int                        _nextSleep;
    int                        _iMount;
-   int                        _miscPort;
    bncRawFile*                _rawFile;
    QextSerialPort*            _serialPort;
@@ -129,6 +126,4 @@
    QMap<QString, long>        _prnLastEpo;
    QMap<char, QVector<QString> > _rnxTypes;
-   QTcpServer*                _miscServer;
-   QList<QTcpSocket*>*        _miscSockets;
 };
 
