bind static method
Binds a DtlsClient to the given host
and port
.
Uses a RawDatagramSocket internally and passes the host
, port
,
reusePort
, reuseAddress
, and ttl
arguments to it.
During connection, the client uses a default maximal timeout of 60 seconds
for each handshake exchange and will resend messages during each exchange
with an increasing delay. The total time span used for the timeout of
message exchanges can be set with the maxTimeoutSeconds
argument.
Implementation
static Future<DtlsClient> bind(dynamic host, int port,
{bool reusePort = false,
bool reuseAddress = true,
int ttl = 1,
int maxTimeoutSeconds = 60,
TinyDTLS? tinyDtls}) async {
final socket = await RawDatagramSocket.bind(host, port,
reusePort: reusePort, reuseAddress: reuseAddress, ttl: ttl);
return DtlsClient(socket,
maxTimeoutSeconds: maxTimeoutSeconds, tinyDTLS: tinyDtls)
.._externalSocket = false;
}