Function

nw_listener_set_new_connection_limit

Resets the number of inbound connections to deliver before rejecting connections.

Declaration

void nw_listener_set_new_connection_limit(nw_listener_t listener, uint32_t new_connection_limit);

Discussion

When the new connection limit is set to a non-infinite value, it will decrement for every received connection. Once the value hits zero, new connections will be queued and eventually blocked, until you raise the limit. This allows you to limit the rate of inbound connections you handle.

By default, the limit is NW_LISTENER_INFINITE_CONNECTION_LIMIT. When the limit is infinite, it does not decrement but allows all inbound connections.

See Also

Receiving Connections

nw_listener_set_new_connection_handler

Sets a handler that receives inbound connections.

nw_listener_new_connection_handler_t

A handler that delivers inbound connections.

nw_listener_get_new_connection_limit

Checks the remaining number of inbound connections to deliver before rejecting connections.

NW_LISTENER_INFINITE_CONNECTION_LIMIT

A static value that indicates that inbound connections should not be limited.