python socket thread stop sample