HANDLER_LISTEN(3)

NAME
handler_listen - initialize server to listen to a given port

SYNOPSIS

#include <libweb/handler.h>

int handler_listen(struct handler *h, unsigned short port, unsigned short *outport);

DESCRIPTION
The handler_listen(3) function initializes the internal server on a struct handler object pointed to by h, which must be previously allocated by a call to handler_alloc(3), to listen on the TCP port given by port. If outport is a valid pointer, handler_listen(3) shall assign the object pointed to by outport to the port number the server shall listen to. This is typically meant for servers that listen on any port, but the caller needs to know which port was eventually selected by the implementation.

RETURN VALUE
On success, zero is returned. On error, a negative integer is returned.

ERRORS
No errors are defined.

SEE ALSO
handler_alloc(3), handler_free(3), handler_add(3), handler_loop(3), libweb_handler(7), signal(7).

COPYRIGHT
Copyright (C) 2023-2024 libweb contributors

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.