TCP Server
The tcp_server class encapsulates the server core which provides methods to create, initialize and start a TCP pre-forked server.
Constructor
Destructor
TCP Server methods
-
int tcp_server_init(tcp_server_t *self_p, const char *server_iface, int server_port, voidVoid_ptr_t callback, int workers_n)
[source] Initialize properties of a tcp_server object.
- Parameters
self_p (tcp_server_t*) – reference to a tcp_server_t object
server_iface (const char*) – name of the network interface to which the server will bind.
server_port (int) – listening port of the server
callback (voidVoid_ptr_t) – connection callback
workers_n (int) – number of workers to dispatch
- Returns
On 0 on success, -1 on failiure.
Note
The connection callback function should be provided by the user application. The callback should be a function pointer of type void (*callbcak) (void *args)