bind static method
Future<DtlsClient>
bind(
- dynamic host,
- int port, {
- bool reuseAddress = true,
- bool reusePort = false,
- int ttl = 1,
- DynamicLibrary? libSsl,
- DynamicLibrary? libCrypto,
- String? cryptoPath,
- String? sslPath,
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.
If you want to load libSsl or libCrypto yourself (e.g., from a custom
path), you can pass custom OpenSslFfi objects to this constructor.
Implementation
static Future<DtlsClient> bind(
dynamic host,
int port, {
bool reuseAddress = true,
bool reusePort = false,
int ttl = 1,
DynamicLibrary? libSsl,
DynamicLibrary? libCrypto,
String? cryptoPath,
String? sslPath,
}) async {
final socket = await RawDatagramSocket.bind(
host,
port,
reuseAddress: reuseAddress,
reusePort: reusePort,
ttl: ttl,
);
return DtlsClient(socket, libSsl: libSsl, libCrypto: libCrypto, cryptoPath: cryptoPath, sslPath: sslPath)
.._externalSocket = false;
}