Everything seems to be working (up through iteration) except ending program. When ctrl+c on client side, server side hangs