server loop