Home  Contents

httpd:listen

Httpd Core4 Lua Event System

SYNOPSIS

flag = httpd:listen([port])

DESCRIPTION

If port is non-nil, starts processing client requests on the specified port.

By calling this function with a nil value, the server stops accepting new client request. This is useful if the web server needs to be enabled or disabled dynamically.

When the server is enabled, calling httpd:listen() again with a different port number will fail. Disable the server first, then re-enable with the new port number.

If you want to support encrypted SSL/TLS connections, use httpd:secureListen() instead.

RETURN VALUE

On success, returns true. On error, three values are returned: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the errno number from the standard C library.

SEE ALSO