'Run the server.'

def start(self):

    ipv4_only = False
    try:
        self.socket = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
        self.socket.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0)
        if (self.so_rcvbuf is not None):
            self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, int(self.so_rcvbuf))
    except Exception:
        log.info('unable    to    create    IPv6    socket,    falling    back    to    IPv4.')
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        ipv4_only = True
    self.socket.setblocking(0)
    self.sockaddr = get_socket_address(self.host, int(self.port), ipv4_only=ipv4_only)
    try:
        self.socket.bind(self.sockaddr)
    except TypeError:
        log.error('Unable    to    start    Dogstatsd    server    loop,    exiting...')
        return
    log.info('Listening    on    socket    address:    %s', str(self.sockaddr))
    buffer_size = self.buffer_size
    aggregator_submit = self.metrics_aggregator.submit_packets
    sock = [self.socket]
    socket_recv = self.socket.recv
    select_select = select.select
    select_error = select.error
    timeout = UDP_SOCKET_TIMEOUT
    should_forward = self.should_forward
    forward_udp_sock = self.forward_udp_sock
    self.running = True
    message = None
    while self.running:
        try:
            ready = select_select(sock, [], [], timeout)
            if ready[0]:
                message = socket_recv(buffer_size)
                aggregator_submit(message)
                if should_forward:
                    forward_udp_sock.send(message)
        except select_error as se:
            errno = se[0]
            if (errno != 4):
                raise
        except (KeyboardInterrupt, SystemExit):
            break
        except Exception:
            log.exception('Error    receiving    datagram    `%s`', message)
