The OpenThread UDP APIs may be invoked via the OpenThread CLI.
Form a network with at least two devices.
On node 1, open and bind the example UDP socket.
> udp open > udp bind :: 1234
The ::
specifies the IPv6 Unspecified Address.
On node 2, open the example UDP socket and send a simple message.
> udp open > udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
On node 1, you should see a print out similar to below:
5 bytes from fdde:ad00:beef:0:dac3:6792:e2e:90d8 49153 hello
List the UDP CLI commands.
> udp help help bind close connect open send Done
Assigns a name (i.e. IPv6 address and port) to the example socket.
::
).> udp bind :: 1234 Done
Closes the example socket.
> udp close Done
Specifies the peer with which the socket is to be associated.
> udp connect fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 Done
Opens the example socket.
> udp open Done
Send a UDP message.
> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
Send a UDP message on a connected socket.
> udp send hello