DtlsClient class

Client for connecting to DTLS Servers and sending UDP packets with encrpyted payloads afterwards.

Uses a RawDatagramSocket for connection establishment and sending. This socket can either be created by the DtlsClient itself, using the bind method, or provided by the user with the regular constructor.

Connections to a peer are established using the connect method. Here, you can either provide PskCredentials or EcdsaKeys for using Elliptic Curve Cryptography (ECC). If the connection is successful, a DtlsConnection is returned that can be used for sending the actual application data.

Closing the DtlsClient with the close method also closes all existing DtlsConnections.

Constructors

DtlsClient(RawDatagramSocket _socket, {int maxTimeoutSeconds = 60, TinyDTLS? tinyDTLS})
Creates a new DtlsClient that uses a pre-existing RawDatagramSocket.

Properties

closed bool
Indicates whether this Client is closed.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close({bool closeExternalSocket = false}) → void
Closes this DtlsClient.
connect(InternetAddress address, int port, {PskCallback? pskCallback, EcdsaKeys? ecdsaKeys, void eventListener(DtlsEvent event)?}) Future<DtlsConnection>
Establishes a DtlsClientConnection with a peer using the given address and port.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

bind(dynamic host, int port, {bool reusePort = false, bool reuseAddress = true, int ttl = 1, int maxTimeoutSeconds = 60, TinyDTLS? tinyDtls}) Future<DtlsClient>
Binds a DtlsClient to the given host and port.