bind static method
Creates a new UDP instance.
The UDP instance is created by the OS and bound to a local Endpoint.
ep
- the local endpoint.
returns the UDP instance.
Implementation
static Future<UDP> bind(Endpoint ep) async {
var udp = UDP._(ep);
if (ep.isMulticast) {
var anyAddress = InternetAddress.anyIPv4;
udp._socket = await RawDatagramSocket.bind(anyAddress, ep.port!.value);
udp._socket!.joinMulticast(ep.address!);
} else {
udp._socket = await RawDatagramSocket.bind(ep.address!, ep.port!.value);
}
return udp;
}