code: def stop(self):
          
          # Stop the loop
          self._stop_event.set()
  
          # Join the thread
          self._thread.join()
          self._thread = None
  
          # Close the socket
          close_multicast_socket(self._socket, self._group)
docs: Stops listening to the socket