do_daemon(3)

NAME
do_daemon() - start a network daemon on given tcp port

SYNOPSIS
#include "fwfunc.h"

int do_daemon(int port)

DESCRIPTION
The do_daemon function forks, parent exits, child starts a new session an performs the following algorithm:

1. bind to the port (if bind fails, sleep for 2 minutes and try again) and

2. wait for connection

3. after a connection is received, fork and make child fd's 1,2,3 pointing to the connection socket as inetd does

4. parent returns to step 2, child returns to calling function

RETURN VALUES
None, though function is declared int for compatibility reasons.

SEE ALSO
setsid(2),inetd(8)

HISTORY
present in fwtk since v2