The external buffer to which the packetbuf is to be copied must be able to accomodate at least 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 accomodate at least PACKETBUF_HDR_SIZE bytes. The number of bytes that was copied to the external buffer is returned.
    +
The source code this function is as follows.
 
<source lang="c">
 
<source lang="c">
 
{
 
{
 
   }
 
   }
 
#endif /* DEBUG_LEVEL */
 
#endif /* DEBUG_LEVEL */
   memcpy(to, packetbuf + hdrptr, PACKETBUF_HDR_SIZE - hdrptr);
+
   memcpy(to, packetbuf + hdrptr, PACKETBUF_HDR_SIZE - hdrptr);//packetbuf points to the beginning of the buffer array.
 
   return PACKETBUF_HDR_SIZE - hdrptr;
 
   return PACKETBUF_HDR_SIZE - hdrptr;
 
}
 
}
      −
In the above potion of code, the main line is the follwing
+
In the above potion of code, the main line is the following
 
  memcpy(to, packetbuf + hdrptr, PACKETBUF_HDR_SIZE - hdrptr);
 
  memcpy(to, packetbuf + hdrptr, PACKETBUF_HDR_SIZE - hdrptr);
Exception encountered, of type "Error"