Index: /trunk/BNC/RTCM3/RTCM3coDecoder.cpp
===================================================================
--- /trunk/BNC/RTCM3/RTCM3coDecoder.cpp	(revision 1221)
+++ /trunk/BNC/RTCM3/RTCM3coDecoder.cpp	(revision 1222)
@@ -109,9 +109,10 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-t_irc RTCM3coDecoder::Decode(char* buffer, int bufLen, vector<string>& errmsg) {
+t_irc RTCM3coDecoder::Decode(char* buffer, int /* bufLen */, 
+                             vector<string>& errmsg) {
 
   errmsg.clear();
 
-  _buffer.append(buffer, bufLen);
+  _buffer.append(buffer);
 
   t_irc retCode = failure;
@@ -198,5 +199,5 @@
         printLine(line, coTime);
       }
-      _buffer = _buffer.substr(bytesused);
+      _buffer = _buffer.mid(bytesused);
       retCode = success;
     }
@@ -205,5 +206,5 @@
     // ---------------
     else {
-      _buffer = _buffer.substr(1);
+      _buffer = _buffer.mid(1);
     }
   }
Index: /trunk/BNC/RTCM3/RTCM3coDecoder.h
===================================================================
--- /trunk/BNC/RTCM3/RTCM3coDecoder.h	(revision 1221)
+++ /trunk/BNC/RTCM3/RTCM3coDecoder.h	(revision 1222)
@@ -56,5 +56,5 @@
   QString             _fileNameSkl;
   QString             _fileName;
-  std::string         _buffer;
+  QByteArray          _buffer;
   ClockOrbit          _co;
   Bias                _bias;
Index: /trunk/BNC/bnccaster.cpp
===================================================================
--- /trunk/BNC/bnccaster.cpp	(revision 1221)
+++ /trunk/BNC/bnccaster.cpp	(revision 1222)
@@ -87,4 +87,16 @@
   }
 
+  int uPort = settings.value("outUPort").toInt();
+  if (uPort != 0) {
+    _uServer = new QTcpServer;
+    _uServer->listen(QHostAddress::Any, uPort);
+    connect(_uServer, SIGNAL(newConnection()), this, SLOT(slotNewUConnection()));
+    _uSockets = new QList<QTcpSocket*>;
+  }
+  else {
+    _uServer  = 0;
+    _uSockets = 0;
+  }
+
   _epochs = new QMultiMap<long, p_obs>;
 
@@ -111,4 +123,6 @@
   delete _server;
   delete _sockets;
+  delete _uServer;
+  delete _uSockets;
   if (_epochs) {
     QListIterator<p_obs> it(_epochs->values());
@@ -136,4 +150,34 @@
   obs->_o.StatID[sizeof(obs->_o.StatID)-1] = '\0';
         
+  const char begObs[] = "BEGOBS";
+  const int begObsNBytes = sizeof(begObs) - 1;
+
+  // Output into the socket
+  // ----------------------
+  if (_uSockets) {
+    QMutableListIterator<QTcpSocket*> is(*_uSockets);
+    while (is.hasNext()) {
+      QTcpSocket* sock = is.next();
+      if (sock->state() == QAbstractSocket::ConnectedState) {
+        bool ok = true;
+        if (myWrite(sock, begObs, begObsNBytes) != begObsNBytes) {
+          ok = false;
+        }
+        int numBytes = sizeof(obs->_o); 
+        if (myWrite(sock, (const char*)(&obs->_o), numBytes) != numBytes) {
+          ok = false;
+        }
+        if (!ok) {
+          delete sock;
+          is.remove();
+        }
+      }
+      else if (sock->state() != QAbstractSocket::ConnectingState) {
+        delete sock;
+        is.remove();
+      }
+    }
+  }
+
   // First time, set the _lastDumpSec immediately
   // --------------------------------------------
@@ -175,4 +219,10 @@
   emit( newMessage(QString("New Connection # %1")
                    .arg(_sockets->size()).toAscii()) );
+}
+
+void bncCaster::slotNewUConnection() {
+  _uSockets->push_back( _uServer->nextPendingConnection() );
+  emit( newMessage(QString("New Connection (usync) # %1")
+                   .arg(_uSockets->size()).toAscii()) );
 }
 
@@ -273,10 +323,8 @@
           while (is.hasNext()) {
             QTcpSocket* sock = is.next();
-            int myFlag = 0;
             if (sock->state() == QAbstractSocket::ConnectedState) {
               bool ok = true;
               if (first) {
                 if (myWrite(sock, begEpoch, begEpochNBytes) != begEpochNBytes) {
-                  myFlag = 1;
                   ok = false;
                 }
@@ -284,10 +332,8 @@
               int numBytes = sizeof(obs->_o); 
               if (myWrite(sock, (const char*)(&obs->_o), numBytes) != numBytes) {
-                myFlag = 2;
                 ok = false;
               }
               if (!it.hasNext()) {
                 if (myWrite(sock, endEpoch, endEpochNBytes) != endEpochNBytes) {
-                  myFlag = 3;
                   ok = false;
                 }
Index: /trunk/BNC/bnccaster.h
===================================================================
--- /trunk/BNC/bnccaster.h	(revision 1221)
+++ /trunk/BNC/bnccaster.h	(revision 1222)
@@ -54,4 +54,5 @@
  private slots:
    void slotNewConnection();
+   void slotNewUConnection();
    void slotGetThreadError(QByteArray staID);
 
@@ -66,5 +67,7 @@
    long                    _lastDumpSec;
    QTcpServer*             _server;
+   QTcpServer*             _uServer;
    QList<QTcpSocket*>*     _sockets;
+   QList<QTcpSocket*>*     _uSockets;
    QList<QByteArray>       _staIDs;
    QList<bncGetThread*>    _threads;
Index: /trunk/BNC/bncwindow.cpp
===================================================================
--- /trunk/BNC/bncwindow.cpp	(revision 1221)
+++ /trunk/BNC/bncwindow.cpp	(revision 1222)
@@ -125,4 +125,6 @@
   _outPortLineEdit    = new QLineEdit(settings.value("outPort").toString());
   _outPortLineEdit->setMaximumWidth(9*ww);
+  _outUPortLineEdit   = new QLineEdit(settings.value("outUPort").toString());
+  _outUPortLineEdit->setMaximumWidth(9*ww);
   _outEphPortLineEdit    = new QLineEdit(settings.value("outEphPort").toString());
   _outEphPortLineEdit->setMaximumWidth(9*ww);
@@ -264,4 +266,5 @@
   _outFileLineEdit->setWhatsThis(tr("Specify the full path to a file where synchronized observations are saved in plain ASCII format. Beware that the size of this file can rapidly increase depending on the number of incoming streams."));
   _outPortLineEdit->setWhatsThis(tr("BNC can produce synchronized observations in binary format on your local host through an IP port. Specify a port number here to activate this function."));
+  _outPortLineEdit->setWhatsThis(tr("Unsynchronized observations in binary format on your local host through an IP port. Specify a port number here to activate this function."));
   _outEphPortLineEdit->setWhatsThis(tr("BNC can produce ephemeris data in RINEX ASCII format on your local host through an IP port. Specify a port number here to activate this function."));
   _corrPortLineEdit->setWhatsThis(tr("BNC can produce Broadcast Ephemeris Corrections on your local host through an IP port. Specify a port number here to activate this function."));
@@ -345,11 +348,13 @@
   sLayout->addWidget(new QLabel("Port"),                          0, 0);
   sLayout->addWidget(_outPortLineEdit,                            0, 1);
+  sLayout->addWidget(new QLabel("Port (Unsynchronized)"),         0, 2);
+  sLayout->addWidget(_outUPortLineEdit,                           0, 3);
   sLayout->addWidget(new QLabel("Wait for full epoch"),           1, 0);
   sLayout->addWidget(_waitTimeSpinBox,                            1, 1);
   sLayout->addWidget(new QLabel("File (full path)"),              2, 0);
-  sLayout->addWidget(_outFileLineEdit,                            2, 1);
+  sLayout->addWidget(_outFileLineEdit,                            2, 1, 1, 3);
   sLayout->addWidget(new QLabel("Sampling"),                      3, 0, Qt::AlignLeft);
   sLayout->addWidget(_binSamplSpinBox,                            3, 1, Qt::AlignLeft);
-  sLayout->addWidget(new QLabel("Output synchronized observations epoch by epoch."),4,0,1,2,Qt::AlignLeft);
+  sLayout->addWidget(new QLabel("Output synchronized observations epoch by epoch."),4,0,1,4,Qt::AlignLeft);
   sLayout->addWidget(new QLabel("    "),5,0);
   sLayout->addWidget(new QLabel("    "),6,0);
@@ -634,4 +639,5 @@
   settings.setValue("perfIntr",    _perfIntrComboBox->currentText());
   settings.setValue("outPort",     _outPortLineEdit->text());
+  settings.setValue("outUPort",    _outUPortLineEdit->text());
   settings.setValue("outEphPort",  _outEphPortLineEdit->text());
   settings.setValue("corrPort",    _corrPortLineEdit->text());
Index: /trunk/BNC/bncwindow.h
===================================================================
--- /trunk/BNC/bncwindow.h	(revision 1221)
+++ /trunk/BNC/bncwindow.h	(revision 1222)
@@ -102,4 +102,5 @@
     QLineEdit* _outFileLineEdit;
     QLineEdit* _outPortLineEdit;
+    QLineEdit* _outUPortLineEdit;
     QLineEdit* _outEphPortLineEdit;
     QLineEdit* _corrPortLineEdit;
