Xiqual 0.9.1

In file xinet/net_create_server.c:

SelectServer* net_create_server

(ulong tag1, ... )

Create a new select() server.


Create a new select() server. All parameters are passed in as a taglist. To create a simple server for no more than 8 connections, at port 1242, calling client_read() to process each incoming message:

SelectServer *server;

server = net_create_server(XN_NUMCONNECTIONS, 16, XN_TIMEOUT_S, 1, XN_PORT, 1242, XN_ONREAD_FUNC, client_read, TAG_END);

The accepted tags for this function are as follows:

XN_NUMCONNECTIONS: Maximum number of connection nodes to make available.

XN_TIMEOUT_S: Timeout in seconds before select() returns.

XN_TIMEOUT_MS: As above, but milliseconds - 10ms being the lowest you can safely expect to work.

XN_PORT: Port to wait for connections on.

XN_LINGER: Number of seconds for sockets to linger after closing. If a socket doesn't have the linger setting activated, it may take up to 5 minutes before the operating system releases all resources properly.

XN_CONNECT_FUNC: Hook called right after connection.

XN_CLOSE_FUNC: Hook called just before shutting down a socket.

XN_ONREAD_FUNC: Hook called to read incoming messages. There is no default reader in libxinet yet.

XN_QUEUE: Maximum listen() queue. Defaults to 5.

tags - Tags defining all server settings.
A pointer to a valid SelectServer structure, with sockets able to listen().
Ronny Bangsund
See Also:
SelectServer, listen(), net_process(), xipacket, net_free_server()

Alphabetic index

This page was generated with the help of DOC++.