|
| 1 | +Echo Server |
| 2 | +########### |
| 3 | + |
| 4 | +Overview |
| 5 | +******** |
| 6 | + |
| 7 | +The echo-server sample application for Zephyr implements a UDP/TCP server |
| 8 | +that complements the echo-client sample application: the echo-server listens |
| 9 | +for incoming IPv4 or IPv6 packets (sent by the echo client) and simply sends |
| 10 | +them back. |
| 11 | + |
| 12 | +The source code for this sample application can be found at: |
| 13 | +:file:`samples/net/echo_server`. |
| 14 | + |
| 15 | +Building and Running |
| 16 | +******************** |
| 17 | + |
| 18 | +There are multiple ways to use this application. One of the most common |
| 19 | +usage scenario is to run echo-server application inside QEMU. This is |
| 20 | +described in :ref:`networking with QEMU <networking_with_qemu>`. |
| 21 | + |
| 22 | +There are configuration files for different boards and setups in the |
| 23 | +echo-server directory: |
| 24 | + |
| 25 | +- :file:`prj_arduino_101_cc2520.conf` |
| 26 | + Use this for Arduino 101 with external IEEE 802.15.4 cc2520 board. |
| 27 | + |
| 28 | +- :file:`prj_arduino_101.conf` |
| 29 | + Use this for Arduino 101 with external enc28j60 ethernet board. |
| 30 | + |
| 31 | +- :file:`prj_bt.conf` |
| 32 | + Use this for Bluetooth IPSP connectivity. |
| 33 | + |
| 34 | +- :file:`prj_cc2520.conf` |
| 35 | + Use this for devices that have support for IEEE 802.15.4 cc2520 chip. |
| 36 | + |
| 37 | +- :file:`prj_frdm_k64f_cc2520.conf` |
| 38 | + Use this for FRDM-K64F board with external IEEE 802.15.4 cc2520 board. |
| 39 | + |
| 40 | +- :file:`prj_frdm_k64f.conf` |
| 41 | + Use this for FRDM-K64F board with built-in ethernet. |
| 42 | + |
| 43 | +- :file:`prj_frdm_k64f_mcr20a.conf` |
| 44 | + Use this for FRDM-K64F board with IEEE 802.15.4 mcr20a board. |
| 45 | + |
| 46 | +- :file:`prj_qemu_802154.conf` |
| 47 | + Use this when simulating IEEE 802.15.4 network using two QEMU's that |
| 48 | + are connected together. |
| 49 | + |
| 50 | +- :file:`prj_qemu_cortex_m3.conf` |
| 51 | + Use this for ARM QEMU. |
| 52 | + |
| 53 | +- :file:`prj_qemu_x86.conf` |
| 54 | + Use this for x86 QEMU. |
| 55 | + |
| 56 | +- :file:`prj_sam_e70_xplained.conf` |
| 57 | + Use this for Atmel SMART SAM E70 Xplained board with ethernet. |
| 58 | + |
| 59 | +Build echo-server sample application like this: |
| 60 | + |
| 61 | +.. code-block:: console |
| 62 | +
|
| 63 | + $ cd $ZEPHYR_BASE/samples/net/echo_server |
| 64 | + $ make pristine && make CONF_FILE=<your desired conf file> \ |
| 65 | + BOARD=<board to use> |
| 66 | +
|
| 67 | +Make can select the default configuration file based on the BOARD you've |
| 68 | +specified automatically so you might not always need to mention it. |
| 69 | + |
| 70 | +Running echo-client in Linux Host |
| 71 | +================================= |
| 72 | + |
| 73 | +There is one useful testing scenario that can be used with Linux host. |
| 74 | +Here echo-server is run in QEMU and echo-client is run in Linux host. |
| 75 | + |
| 76 | +Run 'loop_socat' and 'loop-slip-tap' scripts from net-tools in Linux host. |
| 77 | + |
| 78 | +.. code-block:: console |
| 79 | +
|
| 80 | + $ ./loop_socat.sh |
| 81 | +
|
| 82 | +In another window: |
| 83 | + |
| 84 | +.. code-block:: console |
| 85 | +
|
| 86 | + $ sudo ./loop-slip-tap.sh |
| 87 | +
|
| 88 | +Run echo-server application in QEMU: |
| 89 | + |
| 90 | +.. code-block:: console |
| 91 | +
|
| 92 | + $ cd $ZEPHYR_BASE/samples/net/echo-server |
| 93 | + $ make pristine && make qemu |
| 94 | +
|
| 95 | +In third window: |
| 96 | + |
| 97 | +.. code-block:: console |
| 98 | +
|
| 99 | + $ sudo ./echo-client -i tap0 2001:db8::1 |
| 100 | +
|
| 101 | +Note that echo-server must be running in QEMU before you start the |
| 102 | +echo-client application in host terminal window. |
0 commit comments