netlistener_register4
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.
- 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.vptrfield to theservercodecallback. This can beNULL. - 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.
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.
It is legal to call this function in the any thread.