If you have a daemon listening on port 6666,
connector = accept( listener, (struct sockaddr*)&client, (socklen_t*)&acceptor);
the following commands will be helpful for managing it.
Launch:
nohup ./daemon > /dev/null 2>&1 &
Monitor (use sudo if not root):
netstat -lpn |grep :6666
Above call returns (note the returned PID):
tcp 0 0 0.0.0.0:6666 0.0.0.0:* LISTEN PID/daemon
Terminate:
kill -9 PID