This function copies the packetbuf to an external buffer. Both the data portion and the header portion of the packetbuf is copied. If the packetbuf referenced external data (referenced with packetbuf_reference()) the external data is copied.
 
This function copies the packetbuf to an external buffer. Both the data portion and the header portion of the packetbuf is copied. If the packetbuf referenced external data (referenced with packetbuf_reference()) the external data is copied.
   −
The external buffer to which the packetbuf is to be copied must be able to accommodate at least (PACKETBUF_SIZE + PACKETBUF_HDR_SIZE) bytes. The number of bytes that was copied to the external buffer is returned.
+
The external buffer to which the packetbuf is to be copied must be able to accommodate at least PACKETBUF_SIZE bytes. The number of bytes that was copied to the external buffer is returned.
            Exception encountered, of type "Error"