VALVULA_SOCKET valvula_listener_sock_listen ( ValvulaCtx ctx,
const char *  host,
const char *  port,
axlError **  error 
)

Starts a generic TCP listener on the provided address and port.

This function is used internally by the valvula listener module to startup the valvula listener TCP session associated, however the function can be used directly to start TCP listeners.

Parameters
ctxThe context where the listener is started.
hostHost address to allocate. It can be "127.0.0.1" to only listen for localhost connections or "0.0.0.0" to listen on any address that the server has installed. It cannot be NULL.
portThe port to listen on. It cannot be NULL and it must be a non-zero string.
errorOptional axlError reference where a textual diagnostic will be reported in case of error.
Returns
The function returns the listener socket or -1 if it fails. Optionally the axlError reports the textual especific error found. If the function returns -2 then some parameter provided was found to be NULL.