first server loop