//creation of the archive std::stringbuf stream; std::ostream dataStream(&stream); boost::archive::binary_oarchive ba(dataStream); ba << (const ClassToSend) m_class; //then i send it over network //then i try to recreate the class ClassSomething c(0,0,0); std::stringbuf stream(ios_base::in | ios_base::out); std::streamsize ret = stream.sputn((char*) body, size); std::istream dataStream(&stream); boost::archive::binary_iarchive ba(dataStream); ba >> c;