samples/net/sockets/dumb_http_server_mt/README.html · samples/net/sockets/dumb_http_server_mt/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Networking · Concurrent HTTP

Dumb HTTP server (multi-threaded)

IPv4·IPv6 port 8080에서 여러 client connection을 처리하고 curl과 Apache Bench로 시험합니다.

Official pathsamples/net/sockets/dumb_http_server_mt/README.html
Source filesamples/net/sockets/dumb_http_server_mt/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Single-thread version과 달리 simultaneous connection·TLS·IPv6를 지원하고 POSIX는 지원하지 않습니다.

Connections

Simultaneous

Network

IPv4 · IPv6

Security

TLS capable

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 78959F85186C92D066CF70919C849CE700B8471509667763F361E5FB82E47198
.. zephyr:code-sample:: socket-dumb-http-server-mt
   :name: Dumb HTTP server (multi-threaded)
   :relevant-api: bsd_sockets net_pkt thread_apis tls_credentials

   Implement a simple HTTP server supporting simultaneous connections using BSD sockets.

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 :zephyr:code-sample:`socket-dumb-http-server`
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.

Part 3

한국어 전문 번역

개요

Zephyr의 sockets/dumb_http_server_mt sample application은 BSD Sockets 호환 API로 skeleton HTTP server를 구현합니다.

기능은 single-thread Dumb HTTP server와 비슷하지만 여러 simultaneous connection, TLS와 IPv6를 지원합니다. 반면 이 sample application은 POSIX와 호환되지 않습니다.

이 HTTP server example도 매우 작으며, 들어오는 HTTP request를 실제로 parse하지 않고 읽어서 버린 뒤 항상 static page 하나만 제공합니다.

Source code는 samples/net/sockets/dumb_http_server_mt에 있습니다.

요구 사항

빌드 및 실행

Zephyr version의 multi-thread HTTP server application은 다음처럼 build합니다.

west build -b <board_to_use> samples/net/sockets/dumb_http_server_mt

Sample이 시작되면 IPv4 192.0.2.1 또는 IPv6 2001:db8::1의 port 8080에서 connection을 기다립니다.

Browser에서 http://192.0.2.1:8080/ 또는 http://[2001:db8::1]:8080/을 열면 됩니다. 특정 시점의 Zephyr website에서 가져온 sample content가 표시되므로 현재 site와 다를 수 있습니다.

대신 curl을 사용할 수도 있습니다.

$ curl http://192.0.2.1:8080/

Apache Bench(ab) 같은 HTTP profiling/load tool도 server에 실행할 수 있습니다.

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

-n parameter는 server에 보낼 HTTP request 수를 지정하며 이 example은 10개를 보냅니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.