1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-07-29 21:01:13 +03:00

Add more comments to embedded_c example

This commit is contained in:
bel
2015-10-02 21:02:01 +02:00
parent 0b1ce03d0c
commit de214bf8fa

View File

@ -4,14 +4,16 @@
* License http://opensource.org/licenses/mit-license.php MIT License
*/
/* Simple example program on how to use Embedded C interface. */
/* Simple example program on how to use CivetWeb embedded into a C program. */
#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "civetweb.h"
@ -66,6 +68,7 @@ int ExampleHandler(struct mg_connection *conn, void *cbdata)
int ExitHandler(struct mg_connection *conn, void *cbdata)
{
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n");
mg_printf(conn, "Server will shut down.\n");
mg_printf(conn, "Bye!\n");
exitNow = 1;
return 1;
@ -171,9 +174,12 @@ int WebSocketStartHandler(struct mg_connection *conn, void *cbdata)
#ifdef USE_WEBSOCKET
#define MAX_WS_CLIENTS \
5 /* just for the test: a small number that can be reached */
/* a real server should use a much higher number here */
/* MAX_WS_CLIENTS defines how many clients can connect to a websocket at the
* same time. The value 5 is very small and used here only for demonstration;
* it can be easily tested to connect more than MAX_WS_CLIENTS clients.
* A real server should use a much higher number, or better use a dynamic list
* of currently connected websocket clients. */
#define MAX_WS_CLIENTS (5)
struct t_ws_client {
struct mg_connection *conn;