.\" openfwtk project: do_daemon.3 1-Nov-2000 .TH do_daemon 3 .SH NAME do_daemon() \- start a network daemon on given tcp port .SH SYNOPSIS .nf #include "fwfunc.h" .fi .sp int \fBdo_daemon\fP(int port) .SH DESCRIPTION The \fIdo_daemon\fP function forks, parent exits, child starts a new session an performs the following algorithm: .PP 1. bind to the \fIport\fP (if bind fails, sleep for 2 minutes and try again) and .sp 2. wait for connection .sp 3. after a connection is received, fork and make child fd's 1,2,3 pointing to the connection socket as inetd does .sp 4. parent returns to step 2, child returns to calling function .SH RETURN VALUES None, though function is declared int for compatibility reasons. .SH SEE ALSO setsid(2),inetd(8) .SH HISTORY present in fwtk since v2