where '''"to"''' is the destination address. '''(packetbuf + hdrptr)''' is the address of the buffer entry which stores the first byte of the packet's header. '''(PACKETBUF_HDR_SIZE - hdrptr)''' is the actual size of the header.  
 
where '''"to"''' is the destination address. '''(packetbuf + hdrptr)''' is the address of the buffer entry which stores the first byte of the packet's header. '''(PACKETBUF_HDR_SIZE - hdrptr)''' is the actual size of the header.  
   −
Note that, this function should be used only for outgoing packet. Since the incoming packet header is stored in the data section of the buffer this approach will not work '''(PACKETBUF_HDR_SIZE - hdrptr=0)''' for that.
+
Note that, this function should be used only for outgoing packet. Since the incoming packet header is stored in the data section of the buffer, this approach will not work '''(PACKETBUF_HDR_SIZE - hdrptr=0)''' for that.
    
----
 
----
 
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"