Index: trunk/lib/FlairCore/src/SendData.cpp
===================================================================
--- trunk/lib/FlairCore/src/SendData.cpp	(revision 441)
+++ trunk/lib/FlairCore/src/SendData.cpp	(revision 442)
@@ -121,6 +121,8 @@
   pimpl_->send_size = value;
 
-  if (getUiCom() != NULL)
-    getUiCom()->UpdateDataToSendSize();
+  if (getUiCom() != NULL) {
+      getUiCom()->UpdateDataToSendSize();
+        getUiCom()->UpdateDataToSendBufferSize(this);
+  }
 }
 
Index: trunk/lib/FlairCore/src/ui_com.cpp
===================================================================
--- trunk/lib/FlairCore/src/ui_com.cpp	(revision 441)
+++ trunk/lib/FlairCore/src/ui_com.cpp	(revision 442)
@@ -53,4 +53,8 @@
 
 #ifdef __XENO__
+ Err("multi buffering is not well implemented in RT\n");
+#endif
+
+#ifdef __XENO__
   int status;
   string tmp_name;
@@ -370,9 +374,22 @@
   }
   
+  if(ptr->actual_size==0) {
+      if (IsBigEndian()) {
+        ptr->buf[0] = MULTIPLE_DATA_BIG_ENDIAN;
+      } else {
+        ptr->buf[0]  = MULTIPLE_DATA_LITTLE_ENDIAN;
+      }
+      ptr->actual_size+=sizeof(char);
+      memcpy(ptr->buf+ptr->actual_size,&(ptr->period),sizeof(uint16_t));
+      ptr->actual_size+=sizeof(uint16_t);
+      memcpy(ptr->buf+ptr->actual_size,&(ptr->nb_buffering),sizeof(uint16_t));
+      ptr->actual_size+=sizeof(uint16_t);
+  }
+  
   dataToSend->CopyDatas(ptr->buf+ptr->actual_size);
   ptr->actual_size+=dataToSend->SendSize();
-  Printf("nb buffered %i\n",ptr->actual_size);
+  Printf("nb buffered %i/%i\n",ptr->actual_size,ptr->final_size);
   Printf("pushed size %i period %i nb buffering %i\n",dataToSend->SendSize(),dataToSend->SendPeriod(),dataToSend->NbBuffering());
-  if(ptr->actual_size==ptr->final_size) {
+  if(ptr->actual_size>=ptr->final_size) {//par securité on test aussi le cas ou supérieur
       Printf("ready to send\n");
       //clean
@@ -556,4 +573,5 @@
 
 //TODO: check if it is RT compatible
+//must be called with mutex locked
 void ui_com::UpdateSendData(const SendData *obj) {
   // le mutex est deja pris par l'appellant
@@ -594,4 +612,5 @@
         }
         bufSize*=(*pushedDatasIterator).nb_buffering;
+        if(bufSize!=0) bufSize+=sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t);//header+period+nb_buffering
         if(bufSize!=(*pushedDatasIterator).final_size && bufSize!=0) {
             Printf("change buf size %i->%i\n",(*pushedDatasIterator).final_size,bufSize);
@@ -628,9 +647,12 @@
         tmp.final_size=0;
         for (size_t i = 0; i < datasToSend.size(); i++) {
+            Printf("data %i/%i %i %i\n",i,datasToSend.size(),datasToSend.at(i)->SendPeriod() ,datasToSend.at(i)->NbBuffering());
             if (datasToSend.at(i)->IsEnabled() && datasToSend.at(i)->SendPeriod() == obj->SendPeriod() && datasToSend.at(i)->NbBuffering()==obj->NbBuffering()) {
               tmp.final_size+=datasToSend.at(i)->SendSize();
+              Printf("add %i\n",datasToSend.at(i)->SendSize());
             }
         }
         tmp.final_size*=obj->NbBuffering();
+        tmp.final_size+=sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t);//header+period+nb_buffering
         printf("final size %i\n",tmp.final_size);
         tmp.buf=(char*)malloc(tmp.final_size);
@@ -664,4 +686,28 @@
 }
 
+void ui_com::UpdateDataToSendBufferSize(const SendData *obj) {
+    send_mutex->GetMutex();
+    
+    PushedData_t* ptr=NULL;
+    //get buffer for this couple period/nb_buffering
+    for (size_t i = 0; i < pushedDatas.size(); i++) {
+      if (pushedDatas.at(i).period==obj->SendPeriod() && pushedDatas.at(i).nb_buffering==obj->NbBuffering()) {
+          ptr=&pushedDatas.at(i);
+        }
+    }
+    if(ptr==NULL) {
+        Err("no corresponding match for couple %i %i\n",obj->SendPeriod(),obj->NbBuffering());
+        return;
+    }
+    
+    ptr->final_size=sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t);//header+period+nb_buffering
+    ptr->final_size+=obj->SendSize()*obj->NbBuffering();
+    Printf("final %i\n",ptr->final_size);
+    free(ptr->buf);
+    ptr->buf=(char*)malloc(ptr->final_size);
+    
+    send_mutex->ReleaseMutex();
+}
+
 void ui_com::RemoveSendData(const SendData *obj) {
   // printf("remove_data_to_send %i\n",data_to_send.size());
Index: trunk/lib/FlairCore/src/unexported/communication.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/communication.h	(revision 441)
+++ trunk/lib/FlairCore/src/unexported/communication.h	(revision 442)
@@ -13,4 +13,6 @@
 #define DATA_BIG_ENDIAN 0x03
 #define CLOSING_CONNECTION 0x04
+#define MULTIPLE_DATA_LITTLE_ENDIAN 0x05
+#define MULTIPLE_DATA_BIG_ENDIAN 0x06
 
 //messages file socket
Index: trunk/lib/FlairCore/src/unexported/ui_com.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/ui_com.h	(revision 441)
+++ trunk/lib/FlairCore/src/unexported/ui_com.h	(revision 442)
@@ -45,4 +45,5 @@
   void UpdateSendData(const flair::gui::SendData *obj);//must be called with mutex locked
   void RemoveSendData(const flair::gui::SendData *obj);
+  void UpdateDataToSendBufferSize(const flair::gui::SendData *obj);
   void UpdateDataToSendSize(void);
   void Block(void);
