# ``twisted`.`names`.`dns`.`DNSDatagramProtocol``

class documentation

`class DNSDatagramProtocol(DNSMixin, protocol.DatagramProtocol): (source)`

View In Hierarchy

DNS protocol over UDP.

Method | `datagramReceived` | Read a datagram, extract the message in it and trigger the associated Deferred.
Method | `query` | Send out a message with the given queries.
Method | `removeResend` | Mark message ID as no longer having duplication suppression.
Method | `startListening` | Undocumented
Method | `startProtocol` | Upon start, reset internal state.
Method | `stopProtocol` | Stop protocol: reset state variables.
Method | `writeMessage` | Send a message holding DNS queries.
Instance Variable | `liveMessages` | Undocumented
Instance Variable | `resends` | Undocumented
Instance Variable | `transport` | Undocumented

Inherited from `DNSMixin`:

Method | `__init__` | Undocumented
Method | `callLater` | Wrapper around reactor.callLater, mainly for test purpose.
Method | `pickID` | Return a unique ID for queries.
Instance Variable | `controller` | Undocumented
Instance Variable | `id` | Undocumented
Method | `_clearFailed` | Clean the Deferred after a timeout.
Method | `_query` | Send out a message with the given queries.
Instance Variable | `_reactor` | A `IReactorTime` and `IReactorUDP` provider which will be used to issue DNS queries and manage request timeouts.

Inherited from `DatagramProtocol`:

Method | `connectionRefused` | Called due to error from write in connected mode.
Method | `logPrefix` | Return a prefix matching the class name, to identify log messages related to this protocol instance.

Inherited from `AbstractDatagramProtocol` (via `DatagramProtocol`):

Method | `__getstate__` | Undocumented
Method | `doStart` | Make sure startProtocol is called.
Method | `doStop` | Make sure stopProtocol is called.
Method | `makeConnection` | Make a connection to a transport and a server.
Class Variable | `noisy` | Undocumented
Instance Variable | `numPorts` | Undocumented

def datagramReceived(self, data, addr): (source)
overrides `twisted.internet.protocol.AbstractDatagramProtocol.datagramReceived`
Read a datagram, extract the message in it and trigger the associated Deferred.
def query(self, address, queries, timeout=10, id=None): (source)
Send out a message with the given queries.

Parameters
address:`tuple` of `str` and `int` | The address to which to send the query
queries:`list` of `Query` instances | The queries to transmit
timeout | Undocumented
id | Undocumented
Returns
`Deferred` | Undocumented

def removeResend(self, id): (source)
Mark message ID as no longer having duplication suppression.
def startListening(self): (source)

Undocumented

def startProtocol(self): (source)
overrides `twisted.internet.protocol.AbstractDatagramProtocol.startProtocol`
Upon start, reset internal state.
def stopProtocol(self): (source)
overrides `twisted.internet.protocol.AbstractDatagramProtocol.stopProtocol`
Stop protocol: reset state variables.
def writeMessage(self, message, address): (source)
Send a message holding DNS queries.

Parameters
message:`Message` | Undocumented
address | Undocumented

liveMessages: `dict` = (source)
overrides `twisted.names.dns.DNSMixin.liveMessages`

Undocumented

resends: `dict` = (source)

Undocumented

transport = (source)
overrides `twisted.internet.protocol.DatagramProtocol.transport`

Undocumented