interface documentation

Transport for UDP DatagramProtocols.

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

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.

Parameters
host:stran IP address, not a domain name ('127.0.0.1', not 'localhost')
port:intport to connect to.
def getBroadcastAllowed() -> bool: (source)

Checks if broadcast is currently allowed on this port.

Returns
boolWhether this port may broadcast.

Get this port's host address.

Returns
Union[IPv4Address, IPv6Address]an address describing the listening port.
def setBroadcastAllowed(enabled: bool): (source)

Set whether this port may broadcast.

Parameters
enabled:boolWhether the port may broadcast.
def stopListening() -> Optional[Deferred[None]]: (source)

Stop listening on this port.

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

def write(packet: bytes, addr: Optional[Tuple[str, int]]): (source)

Write packet to given address.

Parameters
packet:bytesUndocumented
addr:Optional[Tuple[str, int]]a 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.
Raises
twisted.internet.error.MessageLengthErrorpacket was too long.