'Main listen loop.'

def run(self):

    while self.LoopDhcpStatus:
        (message, address) = self.sock.recvfrom(1024)
        [client_mac] = struct.unpack('!28x6s', message[:34])
        self.leases[client_mac]['options'] = self.tlv_parse(message[240:])
        type = ord(self.leases[client_mac]['options'][53][0])
        if (type == 1):
            try:
                self.dhcp_offer(message)
                self.sendConnetedClient.emit({'ip_addr': self.leases[client_mac]['ip'], 'host_name': self.leases[client_mac]['options'][12][0], 'mac_addr': self.get_mac([client_mac][0]).lower()})
            except OutOfLeasesError:
                pass
        elif ((type == 3) and (address[0] == '0.0.0.0') and (not self.mode_proxy)):
            self.dhcp_ack(message)
        elif ((type == 3) and (address[0] != '0.0.0.0') and self.mode_proxy):
            self.dhcp_ack(message)
