Next: , Previous: microhttpd-init, Up: Top


6 Implementing external select

— Function: int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd)

Obtain the select() sets for this daemon. The daemon's socket is added to read_fd_set. The list of currently existent connections is scanned and their file descriptors added to the correct set.

After the call completed successfully: the variable referenced by max_fd references the file descriptor with highest integer identifier. The variable must be set to zero before invoking this function.

Return MHD_YES on success, MHD_NO if: the arguments are invalid (example: NULL pointers); this daemon was not started with the right options for this call.

— Function: int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout)

Obtain timeout value for select for this daemon (only needed if connection timeout is used). The returned value is how long select should at most block, not the timeout value set for connections. This function must not be called if the MHD_USE_THREAD_PER_CONNECTION mode is in use (since then it is not meaningful to ask for a timeout, after all, there is concurrenct activity). The function must also not be called by user-code if MHD_USE_INTERNAL_SELECT is in use. In the latter case, the behavior is undefined.

set to the timeout (in milliseconds).

Return MHD_YES on success, MHD_NO if timeouts are not used (or no connections exist that would necessiate the use of a timeout right now).