When you spawn a daemon, and that daemon returns 0, then it usually means that it succesfully listens to that port. Unfortunately with cf-serverd you really can't tell because we use shell to background the process (ampersand), and because logging a dozen thousands lines takes time, sleeping is the way I devised to work around this.

Non-debug daemonises properly, i.e. after binding to the port.