diff --git a/src/cli/cli_udp.cpp b/src/cli/cli_udp.cpp index 65e774f59..fba14f1c0 100644 --- a/src/cli/cli_udp.cpp +++ b/src/cli/cli_udp.cpp @@ -256,6 +256,8 @@ template <> otError UdpExample::Process(Arg aArgs[]) otMessageInfo messageInfo; otMessageSettings messageSettings = {mLinkSecurityEnabled, OT_MESSAGE_PRIORITY_NORMAL}; + VerifyOrExit(otUdpIsOpen(GetInstancePtr(), &mSocket), error = OT_ERROR_INVALID_STATE); + ClearAllBytes(messageInfo); // Possible argument formats: