bind static method

Future<DtlsServer> bind(
  1. dynamic host,
  2. int port,
  3. DtlsServerContext context, {
  4. int ttl = 1,
  5. DynamicLibrary? libCrypto,
  6. DynamicLibrary? libSsl,
  7. String? cryptoPath,
  8. String? sslPath,
})

Binds a DtlsServer to the given host and port, using the security parameters defined in the context.

Uses a RawDatagramSocket internally and passes the host, port, and ttl arguments to it.

Implementation

static Future<DtlsServer> bind(
  dynamic host,
  int port,
  DtlsServerContext context, {
  int ttl = 1,
  DynamicLibrary? libCrypto,
  DynamicLibrary? libSsl,
  String? cryptoPath,
  String? sslPath,
}) async {
  final socket = await RawDatagramSocket.bind(host, port, ttl: ttl);
  return DtlsServer(
    socket,
    context,
    libCrypto: libCrypto,
    libSsl: libSsl,
    cryptoPath: cryptoPath,
    sslPath: sslPath,
  ).._externalSocket = false;
}