Skip to main content

Name

netlistener_register4 — Register a listener, overriding the default TCP receive and send buffers that are set by the netlistener layer

Synopsis

#include "netlistener.h"

| netlistener_def * **netlistener_register4** ( | listener_prefix, |   | |   | servercode, |   | |   | closure, |   | |   | accepthook, |   | |   | recvbuf, |   | |   | sendbuf); |   |

const char * <var class="pdparam">listener_prefix</var>; EventFunc <var class="pdparam">servercode</var>; void * <var class="pdparam">closure</var>; EventFunc <var class="pdparam">accepthook</var>; const char * <var class="pdparam">recvbuf</var>; const char * <var class="pdparam">sendbuf</var>;

Description

Register a listener, overriding the default TCP receive and send buffers that are set by the netlistener layer.

Parameters

listener_prefix

Prefix for the listener in the configuration, e.g. "HTTP".

servercode

Event callback for the connection. The following typedef applies to this data type:

typedef int (*EventFunc) (struct _Event * event, int eventtype, void *closure, struct timeval * now);

closure

Closure to pass in to the accept_construct.accept_construct_closure.vptr field to the servercode callback. This can be NULL.

accepthook

Callback after the connection has been accepted, NULL if not needed. The following typedef applies to this data type:

typedef int (*EventFunc) (struct _Event * event, int eventtype, void *closure, struct timeval * now);

recvbuf

TCP receive buffer size, NULL to use default of 4 KB.

sendbuf

TCP send buffer size, NULL to use default of 4 KB.

Return Values

Returns the address of a netlistener_def instance. For documentation of this data structure see “netlistener_def”. You are responsible for releasing the memory in the structure.

Threading

It is legal to call this function in the any thread.

See Also

Was this page helpful?