1.. zephyr:code-sample:: coap-client
2   :name: CoAP client
3   :relevant-api: coap udp
4
5   Use the CoAP library to implement a client that fetches a resource.
6
7Overview
8********
9
10This sample is a simple CoAP client showing how to retrieve information
11from a resource.
12
13This demo assumes that the platform of choice has networking support,
14some adjustments to the configuration may be needed.
15
16This sample will make a GET request with path 'test' to the IPv6
17multicast address reserved for CoAP nodes, so the URI can be
18represented as:
19
20.. code-block:: none
21
22    coap://[ff02::fd]:5683/test
23
24Building and Running
25********************
26
27This project will print all the octets of the response received, more context can
28be obtained by using a tool such as tcpdump or wireshark.
29
30See the `net-tools`_ project for more details.
31
32This sample can be built and executed on QEMU or native_sim board as described
33in :ref:`networking_with_host`.
34
35Sample output
36=============
37
38.. code-block:: console
39
40  reply: 60 00 00 00 00 24 11 40 fe 80 00 00 00 00 00 00 5c 25 e2 ff fe
41  15 01 01 fe 80 00 00 00 00 00 00 5c 25 e2 ff fe 15 01 01 16 33 16 33
42  00 24 3d 86 60 40 00 01 ff 54 79 70 65 3a 20 30 0a 43 6f 64 65 3a 20
43  31 0a 4d 49 44 3a 20 31 0a (76 bytes)
44
45.. note: The values shown above might differ.
46
47.. _`net-tools`: https://github.com/zephyrproject-rtos/net-tools
48