Known implementations: twisted.internet.iocpreactor.udp.Port, twisted.internet.udp.Port, twisted.names.test.test_util.MemoryDatagramTransport

Transport for UDP DatagramProtocols.

Method write Write packet to given address.
Method connect Connect the transport to an address.
Method getHost Get this port's host address.
Method stopListening Stop listening on this port.
Method setBroadcastAllowed Set whether this port may broadcast.
Method getBroadcastAllowed Checks if broadcast is currently allowed on this port.
def write(packet, addr=None):

Write packet to given address.

Parametersaddra tuple of (ip, port). For connected transports must be the address the transport is connected to, or None. In non-connected mode this is mandatory.
Raisestwisted.internet.error.MessageLengthErrorpacket was too long.
def connect(host, port):

Connect the transport to an address.

This changes it to connected mode. Datagrams can only be sent to this address, and will only be received from this address. In addition the protocol's connectionRefused method might get called if destination is not receiving datagrams.

Parametershostan IP address, not a domain name ('127.0.0.1', not 'localhost')
portport to connect to.
def getHost():

Get this port's host address.

Returnsan address describing the listening port. (type: IPv4Address or IPv6Address.)
def stopListening():

Stop listening on this port.

If it does not complete immediately, will return Deferred that fires upon completion.

def setBroadcastAllowed(enabled):

Set whether this port may broadcast.

ParametersenabledWhether the port may broadcast. (type: bool)
def getBroadcastAllowed():

Checks if broadcast is currently allowed on this port.

ReturnsWhether this port may broadcast. (type: bool)
API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.