complete rewrite of the accepting infinite loop of the server.