throw exception when recv returns false