Complete main server loop.