[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. Starting and stopping the server

Function: struct MHD_Daemon * MHD_start_daemon (unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls, ...)

Start a webserver on the given port.

flags

OR-ed combination of MHD_FLAG values;

port

port to bind to;

apc

callback to call to check which clients will be allowed to connect; you can pass NULL in which case connections from any IP will be accepted;

apc_cls

extra argument to apc;

dh

default handler for all URIs;

dh_cls

extra argument to dh.

Additional arguments are a list of options (type-value pairs, terminated with MHD_OPTION_END). It is mandatory to use MHD_OPTION_END as last argument, even when there are no additional arguments.

Return NULL on error, handle to daemon on success.

Function: void MHD_stop_daemon (struct MHD_Daemon *daemon)

Shutdown an HTTP daemon.

Function: int MHD_run (struct MHD_Daemon *daemon)

Run webserver operations (without blocking unless in client callbacks). This method should be called by clients in combination with MHD_get_fdset() if the client-controlled select() method is used.

Return MHD_YES on success, MHD_NO if this daemon was not started with the right options for this call.


This document was generated by Christian Grothoff on May, 26 2008 using texi2html 1.78.