TransportUdp class

A UDP transport implementation.

This class provides a concrete implementation of the TransportBase abstract class for communication over UDP. It handles the creation, binding, and management of UDP sockets, as well as the sending and receiving of datagrams.

Inheritance

Constructors

TransportUdp({required FullAddress bindAddress, Future<void> onMessage(Packet packet)?, int ttl = 5})
Creates a new TransportUdp instance.

Properties

bindAddress FullAddress
The address to bind to for receiving incoming messages.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
logger ↔ void Function(String)?
A function for logging messages related to transport operations.
getter/setter pairinherited
onMessage Future<void> Function(Packet packet)?
The callback function to invoke when a message is received.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ttl int
The time-to-live for outgoing packets.
getter/setter pairinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(Iterable<FullAddress> fullAddresses, Uint8List datagram) → void
Sends a datagram to the specified addresses.
override
start() Future<void>
Starts the transport.
override
stop() → void
Stops the transport.
override
toString() String
Returns a string representation of the bind address.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultPort → const int
The default port to use for UDP communication.