zephyr/samples/net/sockets/dumb_http_server_mt
Marc Herbert 2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
..
src
CMakeLists.txt samples: make find_package(Zephyr...) REQUIRED 2020-05-29 10:47:25 +02:00
Kconfig
README.rst
overlay-tls.conf
prj.conf
sample.yaml

README.rst

.. _sockets-dumb-http-server-mt-sample:

Socket Multithreaded Dumb HTTP Server
#####################################

Overview
********

The ``sockets/dumb_http_server_mt`` sample application for Zephyr implements a
skeleton HTTP server using a BSD Sockets compatible API.
This sample has similar functionality as :ref:`sockets-dumb-http-server-sample`
except it has support for multiple simultaneous connections, TLS and
IPv6. Also this sample application has no compatibility with POSIX.
This HTTP server example is very minimal and does not really parse an incoming
HTTP request, just reads and discards it, and always serves a single static
page.

The source code for this sample application can be found at:
:zephyr_file:`samples/net/sockets/dumb_http_server_mt`.

Requirements
************

- :ref:`networking_with_host`
- or, a board with hardware networking

Building and Running
********************

Build the Zephyr version of the sockets/dumb_http_server_mt application like
this:

.. zephyr-app-commands::
   :zephyr-app: samples/net/sockets/dumb_http_server_mt
   :board: <board_to_use>
   :goals: build
   :compact:

After the sample starts, it expects connections at 192.0.2.1 or 2001:db8::1,
port 8080. The easiest way to connect is by opening a following URL in a web
browser: http://192.0.2.1:8080/ or http://[2001:db8::1]:8080/
You should see a page with a sample content about Zephyr (captured at a
particular time from Zephyr's web site, note that it may differ from the
content on the live Zephyr site).
Alternatively, a tool like ``curl`` can be used:

.. code-block:: console

    $ curl http://192.0.2.1:8080/

Finally, you can run an HTTP profiling/load tool like Apache Bench
(``ab``) against the server::

    $ ab -n10 http://192.0.2.1:8080/

``-n`` parameter specifies the number of HTTP requests to issue against
a server.