Index: /trunk/lib/FlairCore/src/SendData.cpp
===================================================================
--- /trunk/lib/FlairCore/src/SendData.cpp	(revision 444)
+++ /trunk/lib/FlairCore/src/SendData.cpp	(revision 445)
@@ -122,6 +122,5 @@
 
   if (getUiCom() != NULL) {
-      getUiCom()->UpdateDataToSendSize();
-        getUiCom()->UpdateDataToSendBufferSize(this);
+    getUiCom()->UpdateDataToSendBufferSize(this);
   }
 }
Index: /trunk/lib/FlairCore/src/SendData.h
===================================================================
--- /trunk/lib/FlairCore/src/SendData.h	(revision 444)
+++ /trunk/lib/FlairCore/src/SendData.h	(revision 445)
@@ -58,5 +58,5 @@
 protected:
   /*!
-  * \brief Notify that SenData's datas have changed
+  * \brief Notify that SendData's datas have changed
   *
   * This method must be called when the datas have changed. \n
Index: /trunk/lib/FlairCore/src/ui_com.cpp
===================================================================
--- /trunk/lib/FlairCore/src/ui_com.cpp	(revision 444)
+++ /trunk/lib/FlairCore/src/ui_com.cpp	(revision 445)
@@ -39,12 +39,6 @@
 using namespace flair::gui;
 
-ui_com::ui_com(const Object *parent, UDTSOCKET sock)
-    : Thread(parent, "send", 2,16384*2) {
-  // buffer envoi
-  send_buffer = (char *)malloc(3);
-  send_size = 3; // id(1)+period(2)
-
+ui_com::ui_com(const Object *parent, UDTSOCKET sock) : Thread(parent, "send", 2,16384*2) {
   // mutex
-  send_mutex = NULL;
   send_mutex = new Mutex(this, ObjectName());
 
@@ -150,8 +144,7 @@
   Send(&buf,1);
  
-  if (send_buffer != NULL)
-    free(send_buffer);
-  send_buffer = NULL;
-
+    for (size_t i = 0; i < pushedDatas.size(); i++) {
+      free(pushedDatas.at(i).buf);
+    }
   //Printf("destruction ui_com ok\n");
 }
@@ -264,14 +257,4 @@
 //-> enelver l'alloc du buffer au startup (UpdateDataToSendSize)
 void ui_com::Run(void) {
-  // check endianness
-  char header;
-  if (IsBigEndian()) {
-    header = DATA_BIG_ENDIAN;
-    Printf("System is big endian\n");
-  } else {
-    header = DATA_LITTLE_ENDIAN;
-    Printf("System is little endian\n");
-  }
-
 #ifdef __XENO__
   WarnUponSwitches(true);
@@ -305,23 +288,7 @@
 
       // envoi des donnees
-      int offset = 3;
-      send_buffer[0] = header;
       send_mutex->GetMutex();
 
-      for (size_t i = 0; i < datasToSend.size(); i++) {
-        if (datasToSend.at(i)->SendPeriod() == resume_period && datasToSend.at(i)->IsEnabled() == true) {
-          datasToSend.at(i)->CopyDatas(send_buffer + offset);
-          offset += datasToSend.at(i)->SendSize();
-        }
-      }
-      if (offset != 3) {
-        memcpy(&send_buffer[1], &resume_period, sizeof(uint16_t));
-        //printf("send %i %i %i %x %x\n",resume_period,offset,sizeof(uint16_t),send_buffer,&send_buffer[1]);
-        // for(int i=0;i<offset;i++) printf("%x ",send_buffer[i]);
-        // printf("\n");
-        //Send(send_buffer, offset,resume_period);
-      }
-
-      //test to push datas
+      //mulit buffering
       for (size_t i = 0; i < datasToSend.size(); i++) {
         if (datasToSend.at(i)->SendPeriod() == resume_period && datasToSend.at(i)->IsEnabled() == true) {
@@ -329,5 +296,4 @@
         }
       }
-      //end test
       
       // on planifie la prochaine execution
@@ -375,14 +341,25 @@
   
   if(ptr->actual_size==0) {
-      if (IsBigEndian()) {
-        ptr->buf[0] = MULTIPLE_DATA_BIG_ENDIAN;
+      if(ptr->nb_buffering>1) {
+          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);
       } else {
-        ptr->buf[0]  = MULTIPLE_DATA_LITTLE_ENDIAN;
+          if (IsBigEndian()) {
+            ptr->buf[0] = DATA_BIG_ENDIAN;
+          } else {
+            ptr->buf[0]  = 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);
       }
-      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);
   }
   
@@ -613,5 +590,8 @@
         }
         bufSize*=(*pushedDatasIterator).nb_buffering;
-        if(bufSize!=0) bufSize+=sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t);//header+period+nb_buffering
+        if(bufSize!=0) {
+            bufSize+=sizeof(char)+sizeof(uint16_t);//header+period
+            if((*pushedDatasIterator).nb_buffering>1) bufSize+=sizeof(uint16_t);//+nb_buffering
+        }   
         if(bufSize!=(*pushedDatasIterator).final_size && bufSize!=0) {
             //Printf("change buf size %i->%i\n",(*pushedDatasIterator).final_size,bufSize);
@@ -655,5 +635,6 @@
         }
         tmp.final_size*=obj->NbBuffering();
-        tmp.final_size+=sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t);//header+period+nb_buffering
+        tmp.final_size+=sizeof(char)+sizeof(uint16_t);//header+period
+        if(tmp.nb_buffering>1) tmp.final_size+=sizeof(uint16_t);//+nb_buffering
         //printf("final size %i\n",tmp.final_size);
         tmp.buf=(char*)malloc(tmp.final_size);
@@ -667,22 +648,4 @@
   //Printf("nb buf %i\n",pushedDatas.size());
   return;
-}
-
-//allocate a buffer at startup for the worst case
-//(every data send with same pedriod)
-//TODO: dynamic size depending on what gcs asks?
-void ui_com::UpdateDataToSendSize(void) {
-  send_mutex->GetMutex();
-  send_size = 3; // id(1)+period(2)
-  for (size_t i = 0; i < datasToSend.size(); i++) {
-    if (datasToSend[i] != NULL)
-      send_size += datasToSend[i]->SendSize();
-  }
-
-  // send_buffer=(char*)realloc((void*)send_buffer,send_size*sizeof(char));
-  if (send_buffer != NULL)
-    free(send_buffer);
-  send_buffer = (char *)malloc(send_size * sizeof(char));
-  send_mutex->ReleaseMutex();
 }
 
@@ -704,7 +667,8 @@
     }
     
-    ptr->final_size=sizeof(char)+sizeof(uint16_t)+sizeof(uint16_t);//header+period+nb_buffering
+    ptr->final_size=sizeof(char)+sizeof(uint16_t);//header+period
+    if(ptr->nb_buffering>1) ptr->final_size+=sizeof(uint16_t);//+nb_buffering
     ptr->final_size+=obj->SendSize()*obj->NbBuffering();
-    Printf("final %i\n",ptr->final_size);
+    //Printf("final %i\n",ptr->final_size);
     free(ptr->buf);
     ptr->buf=(char*)malloc(ptr->final_size);
Index: /trunk/lib/FlairCore/src/unexported/ui_com.h
===================================================================
--- /trunk/lib/FlairCore/src/unexported/ui_com.h	(revision 444)
+++ /trunk/lib/FlairCore/src/unexported/ui_com.h	(revision 445)
@@ -46,5 +46,4 @@
   void RemoveSendData(const flair::gui::SendData *obj);
   void UpdateDataToSendBufferSize(const flair::gui::SendData *obj);
-  void UpdateDataToSendSize(void);
   void Block(void);
   void UnBlock(void);
@@ -52,6 +51,4 @@
   void CheckConnection(void);
 private:
-  ssize_t send_size;
-  char *send_buffer;
   std::vector<const flair::gui::SendData *> datasToSend;
   std::vector<flair::core::Time> resumeTimes;
