'Run the server.'

def run(self):

    ssdp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    ssdp_socket.setblocking(False)
    ssdp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    ssdp_socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(self.host_ip_addr))
    ssdp_socket.setsockopt(socket.SOL_IP, socket.IP_ADD_MEMBERSHIP, (socket.inet_aton('239.255.255.250') + socket.inet_aton(self.host_ip_addr)))
    if self.upnp_bind_multicast:
        ssdp_socket.bind(('239.255.255.250', 1900))
    else:
        ssdp_socket.bind((self.host_ip_addr, 1900))
    while True:
        if self._interrupted:
            clean_socket_close(ssdp_socket)
            return
        try:
            (read, _, _) = select.select([self._interrupted_read_pipe, ssdp_socket], [], [ssdp_socket])
            if (self._interrupted_read_pipe in read):
                clean_socket_close(ssdp_socket)
                return
            elif (ssdp_socket in read):
                (data, addr) = ssdp_socket.recvfrom(1024)
            else:
                continue
        except socket.error as ex:
            if self._interrupted:
                clean_socket_close(ssdp_socket)
                return
            _LOGGER.error('UPNP    Responder    socket    exception    occured:    %s', ex.__str__)
        if ('M-SEARCH' in data.decode('utf-8')):
            resp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            resp_socket.sendto(self.upnp_response, addr)
            resp_socket.close()
