1.. zephyr:code-sample:: socket-dumb-http-server-mt
2   :name: Dumb HTTP server (multi-threaded)
3   :relevant-api: bsd_sockets net_pkt thread_apis tls_credentials
4
5   Implement a simple HTTP server supporting simultaneous connections using BSD sockets.
6
7Overview
8********
9
10The ``sockets/dumb_http_server_mt`` sample application for Zephyr implements a
11skeleton HTTP server using a BSD Sockets compatible API.
12This sample has similar functionality as :zephyr:code-sample:`socket-dumb-http-server`
13except it has support for multiple simultaneous connections, TLS and
14IPv6. Also this sample application has no compatibility with POSIX.
15This HTTP server example is very minimal and does not really parse an incoming
16HTTP request, just reads and discards it, and always serves a single static
17page.
18
19The source code for this sample application can be found at:
20:zephyr_file:`samples/net/sockets/dumb_http_server_mt`.
21
22Requirements
23************
24
25- :ref:`networking_with_host`
26- or, a board with hardware networking
27
28Building and Running
29********************
30
31Build the Zephyr version of the sockets/dumb_http_server_mt application like
32this:
33
34.. zephyr-app-commands::
35   :zephyr-app: samples/net/sockets/dumb_http_server_mt
36   :board: <board_to_use>
37   :goals: build
38   :compact:
39
40After the sample starts, it expects connections at 192.0.2.1 or 2001:db8::1,
41port 8080. The easiest way to connect is by opening a following URL in a web
42browser: http://192.0.2.1:8080/ or http://[2001:db8::1]:8080/
43You should see a page with a sample content about Zephyr (captured at a
44particular time from Zephyr's web site, note that it may differ from the
45content on the live Zephyr site).
46Alternatively, a tool like ``curl`` can be used:
47
48.. code-block:: console
49
50    $ curl http://192.0.2.1:8080/
51
52Finally, you can run an HTTP profiling/load tool like Apache Bench
53(``ab``) against the server::
54
55    $ ab -n10 http://192.0.2.1:8080/
56
57``-n`` parameter specifies the number of HTTP requests to issue against
58a server.
59