memcpy(to, packetbuf + hdrptr, PACKETBUF_HDR_SIZE - hdrptr);
memcpy(to, packetbuf + hdrptr, PACKETBUF_HDR_SIZE - hdrptr);
Exception encountered, of type "Error"