# ``twisted`.`names`.`dns`.`DNSProtocol``

class documentation

`class DNSProtocol(DNSMixin, protocol.Protocol): (source)`

View In Hierarchy

DNS protocol over TCP.

Method | `connectionLost` | Notify the controller that this protocol is no longer connected.
Method | `connectionMade` | Connection is made: reset internal state, and notify the controller.
Method | `dataReceived` | Called whenever data is received.
Method | `query` | Send out a message with the given queries.
Method | `writeMessage` | Send a message holding DNS queries.
Instance Variable | `buffer` | Undocumented
Instance Variable | `length` | Undocumented
Instance Variable | `liveMessages` | 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 `Protocol`:

Method | `logPrefix` | Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable | `factory` | Undocumented

Inherited from `BaseProtocol` (via `Protocol`):

Method | `makeConnection` | Make a connection to a transport and a server.
Instance Variable | `connected` | Undocumented
Instance Variable | `transport` | Undocumented

def connectionLost(self, reason): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.Protocol.connectionLost`
Notify the controller that this protocol is no longer connected.
def connectionMade(self): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.BaseProtocol.connectionMade`
Connection is made: reset internal state, and notify the controller.
def dataReceived(self, data): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.Protocol.dataReceived`

Called whenever data is received.

Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.

Parameters
data | a string of indeterminate length. Please keep in mind that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.

def query(self, queries, timeout=60): (source)
Send out a message with the given queries.

Parameters
queries:`list` of `Query` instances | The queries to transmit
timeout | Undocumented
Returns
`Deferred` | Undocumented

def writeMessage(self, message): (source)
Send a message holding DNS queries.

Parameters
message:`Message` | Undocumented

buffer = (source)

Undocumented

length = (source)

Undocumented

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

Undocumented