TransportBase class abstract
Base class for all transport implementations.
This class defines the common interface for sending and receiving data over a network transport. It provides methods for starting and stopping the transport, sending data, and handling incoming messages. Concrete transport implementations, such as UDP or TCP, should extend this class and provide specific implementations for the abstract methods.
- Implementers
Constructors
-
TransportBase({required FullAddress bindAddress, Future<
void> onMessage(Packet packet)?, int ttl = 5, void logger(String)?}) - Creates a new TransportBase instance.
Properties
- bindAddress → FullAddress
-
The address to bind to for receiving incoming messages.
final
- 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 pair
-
onMessage
↔ Future<
void> Function(Packet packet)? -
The callback function to invoke when a message is received.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- ttl ↔ int
-
The time-to-live for outgoing packets.
getter/setter pair
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 one or more addresses.
-
start(
) → Future< void> - Starts the transport.
-
stop(
) → void - Stops the transport.
-
toString(
) → String -
Returns a string representation of the bind address.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited