Index: /XIOS/trunk/src/array_new.hpp
===================================================================
--- /XIOS/trunk/src/array_new.hpp	(revision 730)
+++ /XIOS/trunk/src/array_new.hpp	(revision 731)
@@ -518,5 +518,6 @@
       virtual void reset(void) { this->free(); initialized = false; }
       virtual bool isEmpty(void) const { return !initialized; }
-      virtual size_t size(void) const { return (this->dimensions() + 1) * sizeof(int) + sizeof(size_t) + this->numElements() * sizeof(T_numtype); }
+      virtual size_t size(void) const { return size(this->numElements()); }
+      static size_t size(sizeType numElements) { return (N_rank + 1) * sizeof(int) + sizeof(size_t) + numElements * sizeof(T_numtype); }
 
       virtual CBaseType* clone(void) const { return new CArray(*this); }
Index: /XIOS/trunk/src/context_client.cpp
===================================================================
--- /XIOS/trunk/src/context_client.cpp	(revision 730)
+++ /XIOS/trunk/src/context_client.cpp	(revision 731)
@@ -73,5 +73,4 @@
     }
 
-     
     /*!
     In case of attached mode, the current context must be reset to context for client
@@ -80,25 +79,13 @@
     void CContextClient::sendEvent(CEventClient& event)
     {
-      list<int>::iterator itServer;
-      list<int> ranks;
-      list<int> sizes;
-      list<int>::iterator itSize;
-
-      ranks = event.getRanks();
+      list<int> ranks = event.getRanks();
       if (!event.isEmpty())
       {
-        sizes = event.getSizes();
-        CMessage msg;
-
-        msg << *(sizes.begin()) << timeLine;
-        for (list<int>::iterator it = sizes.begin(); it != sizes.end(); it++) *it += msg.size();
+        list<int> sizes = event.getSizes();
+
         list<CBufferOut*> buffList = getBuffers(ranks, sizes);
 
-        list<CBufferOut*>::iterator it;
-        for (it = buffList.begin(), itSize = sizes.begin(); it != buffList.end(); ++it, ++itSize)
-        {
-          **it << *itSize << timeLine;
-        }
-        event.send(buffList);
+        event.send(timeLine, sizes, buffList);
+
         checkBuffers(ranks);
       }
@@ -271,10 +258,9 @@
    Finalize context client and do some reports
    */
-    
    void CContextClient::finalize(void)
    {
      map<int,CClientBuffer*>::iterator itBuff;
      bool stop = true;
-      
+
      CEventClient event(CContext::GetType(), CContext::EVENT_ID_CONTEXT_FINALIZE);
      if (isServerLeader())
@@ -309,5 +295,4 @@
 
      releaseBuffers();
-     
    }
 }
Index: /XIOS/trunk/src/event_client.cpp
===================================================================
--- /XIOS/trunk/src/event_client.cpp	(revision 730)
+++ /XIOS/trunk/src/event_client.cpp	(revision 731)
@@ -8,83 +8,48 @@
 namespace xios
 {
-   CEventClient::CEventClient(int classId_,int typeId_)
+   const size_t CEventClient::headerSize = sizeof(int) + sizeof(size_t) + sizeof(int) + sizeof(classId) + sizeof(typeId);
+
+   CEventClient::CEventClient(int classId_, int typeId_)
    {
-     classId=classId_ ;
-     typeId=typeId_ ;
+     classId = classId_;
+     typeId = typeId_;
    }
-   
-   void CEventClient::push(int rank,int nbSender,CMessage & msg)
+
+   void CEventClient::push(int rank, int nbSender, CMessage& msg)
    {
-     nbSenders.push_back(nbSender) ;
-     ranks.push_back(rank) ;
-     messages.push_back(&msg) ;
+     nbSenders.push_back(nbSender);
+     ranks.push_back(rank);
+     messages.push_back(&msg);
    }
 
    bool CEventClient::isEmpty(void)
    {
-     return ranks.empty() ;
+     return ranks.empty();
    }
 
-   list<int> CEventClient::getRanks(void)
+   std::list<int> CEventClient::getRanks(void)
    {
-     return ranks ;
-   }
-   
-   list<int> CEventClient::getSizes(void)
-   {
-     list<CMessage*>::iterator it ;
-     list<int> sizes ;
-     size_t headerSize=sizeof(int)+sizeof(classId)+sizeof(typeId) ;
-     
-     for(it=messages.begin();it!=messages.end();++it) sizes.push_back((*it)->size()+headerSize) ;
-     return sizes ;
-   }
-   
-   void CEventClient::send(list<CBufferOut*>& buffers)
-   {
-     list<CBufferOut*>::iterator itBuff ;
-     list<CMessage*>::iterator itMsg ;
-     list<int>::iterator itSenders ;
-     
-     for(itBuff=buffers.begin(),itMsg=messages.begin(),itSenders=nbSenders.begin();itBuff!=buffers.end();++itBuff,++itMsg,++itSenders)
-     {
-       **itBuff<<*itSenders<<classId<<typeId<<**itMsg ;
-     }
-   }   
-/*
-   CEventClient::CEventClient(CContextClient& client_,int nbSender_,list<int>& serverList_)
-   {
-     client=&client_ ;
-     nbSender=nbSender_ ;
-     serverList=serverList_ ;
-     
-     client->registerEvent(*this) ;
+     return ranks;
    }
 
-   list<CBufferOut*> CEventClient::newEvent(int classId, int type, list<int> sizes)
+   std::list<int> CEventClient::getSizes(void)
    {
-     list<int>::iterator it ;
-     list<CBufferOut*>::iterator itBuff;
-     
-     
-     CMessage msg;
-     
-     msg<<nbSender<<classId<<type ;    
-     
-     for(it=sizes.begin();it!=sizes.end();it++) *it+=msg.size() ;
-     list<CBufferOut*> buffers=client->newEvent(*this,sizes) ;
+     std::list<CMessage*>::iterator it;
+     std::list<int> sizes;
 
-     for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++) *(*itBuff)<<msg ;  
-     
-     return buffers ;
-   
-   }
-          
-   void CEventClient::send(void)
-   {
-     client->sendEvent(*this) ;
+     for (it = messages.begin(); it != messages.end(); ++it) sizes.push_back((*it)->size() + headerSize);
+     return sizes;
    }
 
-*/   
-   
+   void CEventClient::send(size_t timeLine, const std::list<int>& sizes, std::list<CBufferOut*>& buffers)
+   {
+     std::list<CBufferOut*>::iterator itBuff = buffers.begin();
+     std::list<int>::const_iterator itSizes = sizes.begin(), itSenders = nbSenders.begin();
+     std::list<CMessage*>::iterator itMsg = messages.begin();
+
+     for (; itBuff != buffers.end(); ++itBuff, ++itSizes, ++itSenders, ++itMsg)
+     {
+       **itBuff << *itSizes << timeLine << *itSenders << classId << typeId << **itMsg;
+     }
+   }
 }
Index: /XIOS/trunk/src/event_client.hpp
===================================================================
--- /XIOS/trunk/src/event_client.hpp	(revision 730)
+++ /XIOS/trunk/src/event_client.hpp	(revision 731)
@@ -8,26 +8,25 @@
 namespace xios
 {
- 
   class CEventClient
   {
     public:
-    
-//    CEventClient(CContextClient& client,int nbSender,list<int>& serverList);  
-    CEventClient(int classId, int typeId);
-    void push(int rank,int nbSender, CMessage& msg) ;  
+      static const size_t headerSize;
 
-//    list<CBufferOut*> newEvent(int classId, int type, list<int> sizes) ;
-    list<int> getRanks(void) ;
-    list<int> getSizes(void) ;
-    void send(list<CBufferOut*>&) ;   
-    bool isEmpty(void) ;
-    list<int> ranks ;
-    list<int> nbSenders ;
-    list<CMessage*> messages ;
-//    CContextClient* client ;
-    int classId ;
-    int typeId ;
-  } ;
+      CEventClient(int classId, int typeId);
 
+      void push(int rank, int nbSender, CMessage& msg);
+      void send(size_t timeLine, const std::list<int>& sizes, std::list<CBufferOut*>&); 
+
+      bool isEmpty(void);
+      std::list<int> getRanks(void);
+      std::list<int> getSizes(void);
+
+    private:
+      int classId;
+      int typeId;
+      std::list<int> ranks;
+      std::list<int> nbSenders;
+      std::list<CMessage*> messages;
+  };
 }
 
Index: /XIOS/trunk/src/node/axis.cpp
===================================================================
--- /XIOS/trunk/src/node/axis.cpp	(revision 730)
+++ /XIOS/trunk/src/node/axis.cpp	(revision 731)
@@ -116,4 +116,59 @@
    {
      return offsetWrittenIndexes_;
+   }
+
+   //----------------------------------------------------------------
+
+   /*!
+    * Compute the minimum buffer size required to send the attributes to the server(s).
+    *
+    * \return A map associating the server rank with its minimum buffer size.
+    */
+   std::map<int, StdSize> CAxis::getAttributesBufferSize()
+   {
+     CContextClient* client = CContext::getCurrent()->client;
+
+     std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes();
+
+     bool isNonDistributed = (n == n_glo);
+
+     if (client->isServerLeader())
+     {
+       // size estimation for sendServerAttribut
+       size_t size = 6 * sizeof(size_t);
+       // size estimation for sendNonDistributedValue
+       if (isNonDistributed)
+         size = std::max(size, CArray<double,1>::size(n_glo) + (isCompressible_ ? CArray<int,1>::size(n_glo) : 0));
+       size += CEventClient::headerSize + getId().size() + sizeof(size_t);
+
+       const std::list<int>& ranks = client->getRanksServerLeader();
+       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
+       {
+         if (size > attributesSizes[*itRank])
+           attributesSizes[*itRank] = size;
+       }
+     }
+
+     if (!isNonDistributed)
+     {
+       // size estimation for sendDistributedValue
+       std::map<int, std::vector<size_t> >::const_iterator it, ite = indSrv_.end();
+       for (it = indSrv_.begin(); it != ite; ++it)
+       {
+         size_t sizeIndexEvent = CArray<int,1>::size(it->second.size());
+         if (isCompressible_)
+           sizeIndexEvent += CArray<int,1>::size(indWrittenSrv_[it->first].size());
+
+         size_t sizeValEvent = CArray<double,1>::size(it->second.size());
+         if (hasBounds_)
+           sizeValEvent += CArray<double,2>::size(it->second.size());
+
+         size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeValEvent);
+         if (size > attributesSizes[it->first])
+           attributesSizes[it->first] = size;
+       }
+     }
+
+     return attributesSizes;
    }
 
Index: /XIOS/trunk/src/node/axis.hpp
===================================================================
--- /XIOS/trunk/src/node/axis.hpp	(revision 730)
+++ /XIOS/trunk/src/node/axis.hpp	(revision 731)
@@ -71,4 +71,6 @@
          int getTotalNumberWrittenIndexes() const;
          int getOffsetWrittenIndexes() const;
+
+         std::map<int, StdSize> getAttributesBufferSize();
 
          /// Test ///
Index: /XIOS/trunk/src/node/context.cpp
===================================================================
--- /XIOS/trunk/src/node/context.cpp	(revision 730)
+++ /XIOS/trunk/src/node/context.cpp	(revision 731)
@@ -266,7 +266,7 @@
    void CContext::setClientServerBuffer()
    {
-     size_t bufferSizeMin = CXios::minBufferSize;
+     size_t minBufferSize = CXios::minBufferSize;
 #define DECLARE_NODE(Name_, name_)    \
-     if (bufferSizeMin < sizeof(C##Name_##Definition)) bufferSizeMin = sizeof(C##Name_##Definition);
+     if (minBufferSize < sizeof(C##Name_##Definition)) minBufferSize = sizeof(C##Name_##Definition);
 #define DECLARE_NODE_PAR(Name_, name_)
 #include "node_type.conf"
@@ -274,9 +274,13 @@
 #undef DECLARE_NODE_PAR
 
-     std::map<int, StdSize> bufferSize = getDataSize();
-     std::map<int, StdSize>::iterator it  = bufferSize.begin(),
-                                      ite = bufferSize.end();
-     for (; it != ite; ++it)
-       if (it->second < bufferSizeMin) it->second = bufferSizeMin;
+     std::map<int, StdSize> bufferSize = getAttributesBufferSize();
+     std::map<int, StdSize>::iterator it, ite = bufferSize.end();
+     for (it = bufferSize.begin(); it != ite; ++it)
+       if (it->second < minBufferSize) it->second = minBufferSize;
+
+     std::map<int, StdSize> dataBufferSize = getDataBufferSize();
+     ite = dataBufferSize.end();
+     for (it = dataBufferSize.begin(); it != ite; ++it)
+       if (it->second > bufferSize[it->first]) bufferSize[it->first] = it->second;
 
      if (client->isServerLeader())
@@ -284,5 +288,5 @@
        const std::list<int>& ranks = client->getRanksServerLeader();
        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
-         if (!bufferSize.count(*itRank)) bufferSize[*itRank] = bufferSizeMin;
+         if (!bufferSize.count(*itRank)) bufferSize[*itRank] = minBufferSize;
      }
 
@@ -791,5 +795,33 @@
    }
 
-   std::map<int, StdSize>& CContext::getDataSize()
+   std::map<int, StdSize>& CContext::getAttributesBufferSize()
+   {
+     std::map<int, StdSize> attributesSize;
+
+     size_t numEnabledFiles = this->enabledFiles.size();
+     for (size_t i = 0; i < numEnabledFiles; ++i)
+     {
+       CFile* file = this->enabledFiles[i];
+
+       std::vector<CField*> enabledFields = file->getEnabledFields();
+       size_t numEnabledFields = enabledFields.size();
+       for (size_t j = 0; j < numEnabledFields; ++j)
+       {
+         const std::map<int, StdSize> mapSize = enabledFields[j]->getGridAttributesBufferSize();
+         std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end();
+         for (; it != itE; ++it)
+         {
+           // If attributesSize[it->first] does not exist, it will be zero-initialized
+           // so we can use it safely without checking for its existance
+           if (attributesSize[it->first] < it->second)
+             attributesSize[it->first] = it->second;
+         }
+       }
+     }
+
+     return attributesSize;
+   }
+
+   std::map<int, StdSize>& CContext::getDataBufferSize()
    {
      CFile::mode_attr::t_enum mode = hasClient ? CFile::mode_attr::write : CFile::mode_attr::read;
@@ -810,5 +842,5 @@
          for (size_t j = 0; j < numEnabledFields; ++j)
          {
-           const std::map<int, StdSize> mapSize = enabledFields[j]->getGridDataSize();
+           const std::map<int, StdSize> mapSize = enabledFields[j]->getGridDataBufferSize();
            std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end();
            for (; it != itE; ++it)
Index: /XIOS/trunk/src/node/context.hpp
===================================================================
--- /XIOS/trunk/src/node/context.hpp	(revision 730)
+++ /XIOS/trunk/src/node/context.hpp	(revision 731)
@@ -120,5 +120,6 @@
          void postProcessing();
 
-         std::map<int, StdSize>& getDataSize();
+         std::map<int, StdSize>& getAttributesBufferSize();
+         std::map<int, StdSize>& getDataBufferSize();
          void setClientServerBuffer();
 
Index: /XIOS/trunk/src/node/domain.cpp
===================================================================
--- /XIOS/trunk/src/node/domain.cpp	(revision 730)
+++ /XIOS/trunk/src/node/domain.cpp	(revision 731)
@@ -102,4 +102,51 @@
    {
      return offsetWrittenIndexes_;
+   }
+
+   //----------------------------------------------------------------
+
+   /*!
+    * Compute the minimum buffer size required to send the attributes to the server(s).
+    *
+    * \return A map associating the server rank with its minimum buffer size.
+    */
+   std::map<int, StdSize> CDomain::getAttributesBufferSize()
+   {
+     CContextClient* client = CContext::getCurrent()->client;
+
+     std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes();
+
+     if (client->isServerLeader())
+     {
+       // size estimation for sendServerAttribut
+       size_t size = 11 * sizeof(size_t);
+
+       const std::list<int>& ranks = client->getRanksServerLeader();
+       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
+       {
+         if (size > attributesSizes[*itRank])
+           attributesSizes[*itRank] = size;
+       }
+     }
+
+     std::map<int, std::vector<size_t> >::const_iterator it, ite = indSrv_.end();
+     for (it = indSrv_.begin(); it != ite; ++it)
+     {
+       // size estimation for sendIndex (and sendArea which is always smaller or equal)
+       size_t sizeIndexEvent = 2 * sizeof(size_t) + 2 * CArray<int,1>::size(it->second.size());
+       if (isCompressible_)
+         sizeIndexEvent += CArray<int,1>::size(indWrittenSrv_[it->first].size());
+
+       // size estimation for sendLonLat
+       size_t sizeLonLatEvent = CArray<double,1>::size(it->second.size());
+       if (hasBounds)
+         sizeLonLatEvent += CArray<double,2>::size(it->second.size());
+
+       size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeLonLatEvent);
+       if (size > attributesSizes[it->first])
+         attributesSizes[it->first] = size;
+     }
+
+     return attributesSizes;
    }
 
Index: /XIOS/trunk/src/node/domain.hpp
===================================================================
--- /XIOS/trunk/src/node/domain.hpp	(revision 730)
+++ /XIOS/trunk/src/node/domain.hpp	(revision 731)
@@ -90,4 +90,6 @@
          int getTotalNumberWrittenIndexes() const;
          int getOffsetWrittenIndexes() const;
+
+         std::map<int, StdSize> getAttributesBufferSize();
 
          bool isEmpty(void) const;
Index: /XIOS/trunk/src/node/field.cpp
===================================================================
--- /XIOS/trunk/src/node/field.cpp	(revision 730)
+++ /XIOS/trunk/src/node/field.cpp	(revision 731)
@@ -527,7 +527,12 @@
    }
 
-   std::map<int, StdSize> CField::getGridDataSize()
-   {
-     return grid->getConnectedServerDataSize();
+   std::map<int, StdSize> CField::getGridAttributesBufferSize()
+   {
+     return grid->getAttributesBufferSize();
+   }
+
+   std::map<int, StdSize> CField::getGridDataBufferSize()
+   {
+     return grid->getDataBufferSize(getId());
    }
 
Index: /XIOS/trunk/src/node/field.hpp
===================================================================
--- /XIOS/trunk/src/node/field.hpp	(revision 730)
+++ /XIOS/trunk/src/node/field.hpp	(revision 731)
@@ -93,5 +93,6 @@
          void resetNStepMax();
 
-         std::map<int, StdSize> getGridDataSize();
+         std::map<int, StdSize> getGridAttributesBufferSize();
+         std::map<int, StdSize> getGridDataBufferSize();
 
        public:
Index: /XIOS/trunk/src/node/grid.cpp
===================================================================
--- /XIOS/trunk/src/node/grid.cpp	(revision 730)
+++ /XIOS/trunk/src/node/grid.cpp	(revision 731)
@@ -84,59 +84,66 @@
    }
 
-   std::map<int, StdSize> CGrid::getConnectedServerDataSize()
-   {
-     double secureFactor = 2.5 * sizeof(double) * CXios::bufferSizeFactor;
-     StdSize retVal = 1;
-     std::map<int, StdSize> ret;
-     std::map<int, size_t >::const_iterator itb = connectedDataSize_.begin(), it, itE = connectedDataSize_.end();
-
-     if (isScalarGrid())
+   /*!
+    * Compute the minimum buffer size required to send the attributes to the server(s).
+    *
+    * \return A map associating the server rank with its minimum buffer size.
+    */
+   std::map<int, StdSize> CGrid::getAttributesBufferSize()
+   {
+     std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes();
+
+     // The grid indexes require a similar size as the actual data
+     std::map<int, StdSize> dataSizes = getDataBufferSize();
+     std::map<int, StdSize>::iterator it, itE = dataSizes.end();
+     for (it = dataSizes.begin(); it != itE; ++it)
      {
-       for (it = itb; it != itE; ++it)
+       it->second += 2 * sizeof(bool);
+       if (it->second > attributesSizes[it->first])
+         attributesSizes[it->first] = it->second;
+     }
+
+     // Account for the axis attributes
+     std::vector<CAxis*> axisList = getAxis();
+     for (size_t i = 0; i < axisList.size(); ++i)
+     {
+       std::map<int, StdSize> axisAttBuffSize = axisList[i]->getAttributesBufferSize();
+       for (it = axisAttBuffSize.begin(), itE = axisAttBuffSize.end(); it != itE; ++it)
        {
-         retVal *= secureFactor;
-         ret.insert(std::make_pair(it->first, retVal));
-       }
-       return ret;
-     }
-
-     for (it = itb; it != itE; ++it)
-     {
-        retVal = it->second;
-        retVal *= secureFactor;
-        ret.insert(std::make_pair<int,StdSize>(it->first, retVal));
-     }
-
-     if (connectedDataSize_.empty())
-     {
-       for (int i = 0; i < connectedServerRank_.size(); ++i)
-       {
-         retVal = 1;
-         retVal *= secureFactor;
-         ret.insert(std::make_pair<int,StdSize>(connectedServerRank_[i], retVal));
+         if (it->second > attributesSizes[it->first])
+           attributesSizes[it->first] = it->second;
        }
      }
 
-     // In some cases in which domain is masked, we need to count for connected server for longitude and latitude
-     std::vector<CDomain*> domListP = this->getDomains();
-     if (!domListP.empty())
+     // Account for the domain attributes
+     std::vector<CDomain*> domList = getDomains();
+     for (size_t i = 0; i < domList.size(); ++i)
      {
-       for (int i = 0; i < domListP.size(); ++i)
+       std::map<int, StdSize> domAttBuffSize = domList[i]->getAttributesBufferSize();
+       for (it = domAttBuffSize.begin(), itE = domAttBuffSize.end(); it != itE; ++it)
        {
-         const std::map<int, vector<size_t> >& indexDomainServer = domListP[i]->getIndexServer();
-         std::map<int, vector<size_t> >::const_iterator itDom = indexDomainServer.begin(), iteDom = indexDomainServer.end();
-         for (; itDom != iteDom; ++itDom)
-         {
-           if (ret.end() == ret.find(itDom->first))
-           {
-              retVal = (itDom->second).size();
-              retVal *= secureFactor;
-              ret.insert(std::make_pair<int,StdSize>(itDom->first, retVal));
-           }
-         }
+         if (it->second > attributesSizes[it->first])
+           attributesSizes[it->first] = it->second;
        }
      }
-
-     return ret;
+     
+     return attributesSizes;
+   }
+
+   /*!
+    * Compute the minimum buffer size required to send the data to the server(s).
+    *
+    * \param id the id used to tag the data
+    * \return A map associating the server rank with its minimum buffer size.
+    */
+   std::map<int, StdSize> CGrid::getDataBufferSize(const std::string& id /*= ""*/)
+   {
+     std::map<int, StdSize> dataSizes;
+     const size_t extraSize = CEventClient::headerSize + (id.empty() ? getId() : id).size() + sizeof(size_t);
+
+     std::map<int, size_t>::const_iterator itb = connectedDataSize_.begin(), it, itE = connectedDataSize_.end();
+     for (it = itb; it != itE; ++it)
+       dataSizes.insert(std::make_pair(it->first, extraSize + CArray<double,1>::size(it->second)));
+
+     return dataSizes;
    }
 
Index: /XIOS/trunk/src/node/grid.hpp
===================================================================
--- /XIOS/trunk/src/node/grid.hpp	(revision 730)
+++ /XIOS/trunk/src/node/grid.hpp	(revision 731)
@@ -158,5 +158,6 @@
          void computeDomConServer();
          std::map<int, int> getDomConServerSide();
-         std::map<int, StdSize> getConnectedServerDataSize();
+         std::map<int, StdSize> getAttributesBufferSize();
+         std::map<int, StdSize> getDataBufferSize(const std::string& id = "");
          std::vector<StdString> getDomainList();
          std::vector<StdString> getAxisList();
Index: /XIOS/trunk/src/object_template.hpp
===================================================================
--- /XIOS/trunk/src/object_template.hpp	(revision 730)
+++ /XIOS/trunk/src/object_template.hpp	(revision 731)
@@ -54,4 +54,5 @@
          /// Traitement statique ///
          static void ClearAllAttributes(void);
+         std::map<int, size_t> getMinimumBufferSizeForAttributes();
          void sendAttributToServer(const string& id);
          void sendAttributToServer(CAttribute& attr) ;
Index: /XIOS/trunk/src/object_template_impl.hpp
===================================================================
--- /XIOS/trunk/src/object_template_impl.hpp	(revision 730)
+++ /XIOS/trunk/src/object_template_impl.hpp	(revision 731)
@@ -162,4 +162,39 @@
 
    template<typename T>
+   std::map<int, size_t> CObjectTemplate<T>::getMinimumBufferSizeForAttributes()
+   {
+     CContextClient* client = CContext::getCurrent()->client;
+     std::map<int, size_t> minimumSizes;
+
+     if (client->isServerLeader())
+     {
+       size_t minimumSize = 0;
+       CAttributeMap& attrMap = *this;
+       CAttributeMap::const_iterator it = attrMap.begin(), itE = attrMap.end();
+       for (; it != itE; ++it)
+       {
+         if (!it->second->isEmpty())
+         {
+           size_t size = it->second->getName().size() + it->second->size();
+           if (size > minimumSize)
+             minimumSize = size;
+         }
+       }
+
+       if (minimumSize)
+       {
+         // Account for extra header info
+         minimumSize += CEventClient::headerSize + getIdServer().size();
+
+         const std::list<int>& ranks = client->getRanksServerLeader();
+         for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
+           minimumSizes.insert(std::make_pair(*itRank, minimumSize));
+       }
+     }
+
+     return minimumSizes;
+   }
+
+   template<typename T>
    void CObjectTemplate<T>::sendAllAttributesToServer()
    {
@@ -170,5 +205,4 @@
        if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second));
      }
-
    }
 
