transport: Serialize socket write operations

Change-Id: Ieccaf0ccbd6ee8bd08b1eee77d781edd47b2cbb2
Refs: #1769, #1775
diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index ed265b0..eeb0c3f 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -31,6 +31,7 @@
 #include "buffer-stream.hpp"
 
 #include <boost/lexical_cast.hpp>
+#include <boost/asio/buffer.hpp>
 
 namespace ndn {
 
@@ -397,4 +398,10 @@
               boost::lexical_cast<std::string>(type) + "] from Block");
 }
 
+Block::operator boost::asio::const_buffer() const
+{
+  return boost::asio::const_buffer(wire(), size());
+}
+
+
 } // namespace ndn