Index: trunk/BNC/RTCM3/RTCM3coDecoder.cpp
===================================================================
--- trunk/BNC/RTCM3/RTCM3coDecoder.cpp	(revision 868)
+++ trunk/BNC/RTCM3/RTCM3coDecoder.cpp	(revision 869)
@@ -59,16 +59,29 @@
 t_irc RTCM3coDecoder::Decode(char* buffer, int bufLen) {
 
-  memset(&_co, 0, sizeof(_co));
-  int irc = GetClockOrbitBias(&_co, &_bias, buffer, bufLen);
-  
-  printf("EPOCH %d %d %d\n", irc, _co.GPSEpochTime, _co.NumberOfGPSSat);
+  _buffer.append(buffer, bufLen);
 
-  for(int ii = 0; ii < _co.NumberOfGPSSat; ++ii) {
-    printf("%d G%d %d %f %f %f %f\n", _co.GPSEpochTime,
-           _co.Sat[ii].ID, _co.Sat[ii].IOD, _co.Sat[ii].Clock.DeltaA0,
-           _co.Sat[ii].Orbit.DeltaRadial, _co.Sat[ii].Orbit.DeltaAlongTrack,
-           _co.Sat[ii].Orbit.DeltaCrossTrack);
+  while (true) {
+    memset(&_co, 0, sizeof(_co));
+    int irc = GetClockOrbitBias(&_co, &_bias, 
+                                _buffer.data(), _buffer.size());
+    if      (irc == -2) {  // not enough data
+      return failure;
+    }
+    else if (irc == -3) {  // not synchronized
+      _buffer = _buffer.substr(1);
+    }
+    else if (irc == 0) {
+      for(int ii = 0; ii < _co.NumberOfGPSSat; ++ii) {
+        printf("%d G%d %d %f %f %f %f\n", _co.GPSEpochTime,
+               _co.Sat[ii].ID, _co.Sat[ii].IOD, _co.Sat[ii].Clock.DeltaA0,
+               _co.Sat[ii].Orbit.DeltaRadial, _co.Sat[ii].Orbit.DeltaAlongTrack,
+               _co.Sat[ii].Orbit.DeltaCrossTrack);
+      }
+      _buffer = _buffer.substr(1);
+      return success;
+    }
+    else {
+      return failure;
+    }
   }
-
-  return success;
 }
Index: trunk/BNC/RTCM3/RTCM3coDecoder.h
===================================================================
--- trunk/BNC/RTCM3/RTCM3coDecoder.h	(revision 868)
+++ trunk/BNC/RTCM3/RTCM3coDecoder.h	(revision 869)
@@ -38,6 +38,7 @@
   virtual t_irc Decode(char* buffer = 0, int bufLen = 0);
 private:
-  ClockOrbit _co;
-  Bias       _bias;
+  std::string _buffer;
+  ClockOrbit  _co;
+  Bias        _bias;
 } ;
 
