ot::Coap::Message::Clone() const method
Creates a copy of this CoAP message. It allocates the new message from the same message pool as the original one and copies @p aLength octets of the payload. The `Type`, `SubType`, `LinkSecurity`, `Offset`, `InterfaceId`, and `Priority` fields on the cloned message are also copied from the original one.
Arguments
aLength
Number of payload bytes to copy.
Return value
A pointer to the message or `nullptr` if insufficient message buffers are available.