def stop(self):
        """Stop thread."""
        if self._thread:
            self.signal.put("Stop")
            self._thread.join()
            if self._soc:
                self._soc.shutdown()
                self._soc.close()
            self._thread = None
Stop thread.