From a46786b0e878173c72c3c52c358219c589c936fe Mon Sep 17 00:00:00 2001 From: Esko Dijk Date: Tue, 18 Jun 2024 18:17:11 +0200 Subject: [PATCH] [cli] `udp bind` doc update to clarify that multicast address cannot be used as argument (#10370) --- src/cli/README_UDP.md | 4 +++- src/cli/cli_udp.cpp | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cli/README_UDP.md b/src/cli/README_UDP.md index 720aa880f..7c365ee96 100644 --- a/src/cli/README_UDP.md +++ b/src/cli/README_UDP.md @@ -71,7 +71,7 @@ Assigns a name (i.e. IPv6 address and port) to the example socket. - not specified: Thread network interface. - `-u`: unspecified network interface. - `-b`: Backbone network interface. -- ip: the IPv6 address or the unspecified IPv6 address (`::`). +- ip: the unicast IPv6 address or the unspecified IPv6 address (`::`). - port: the UDP port ```bash @@ -83,6 +83,8 @@ Done Done ``` +> Note: to receive datagrams sent to a multicast IPv6 address, the unspecified IPv6 address must be used. Using a multicast address for the \ argument is not supported. Also, the node must subscribe to the multicast group using `ipmaddr add` before it can receive UDP multicast. + ### close Closes the example socket. diff --git a/src/cli/cli_udp.cpp b/src/cli/cli_udp.cpp index fba14f1c0..257b188ab 100644 --- a/src/cli/cli_udp.cpp +++ b/src/cli/cli_udp.cpp @@ -70,9 +70,9 @@ UdpExample::UdpExample(otInstance *aInstance, OutputImplementer &aOutputImplemen * - `-u`: Unspecified network interface, which means that the UDP/IPv6 stack determines which * network interface to bind the socket to. * - `-b`: Backbone network interface is used. - * - `ip`: IPv6 address to bind to. If you wish to have the UDP/IPv6 stack assign the binding - * IPv6 address, then you can use the following value to use the unspecified - * IPv6 address: `::`. Each example uses the unspecified IPv6 address. + * - `ip`: Unicast IPv6 address to bind to. If you wish to have the UDP/IPv6 stack assign the binding + * IPv6 address, or if you wish to bind to multicast IPv6 addresses, then you can use the following + * value to use the unspecified IPv6 address: `::`. Each example uses the unspecified IPv6 address. * - `port`: UDP port number to bind to. Each of the examples is using port number 1234. * @par * Assigns an IPv6 address and a port to an open socket, which binds the socket for communication.