-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: multicast_dnsThe mdns packageThe mdns packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Use case
I am trying to find the IP of SRV target.
Examples of srv:
eWeLink_10013abc14.local
HPC0180319938E.local
MiWiFi-RM1800-srv.local
I have tried:
-
await InternetAddress.lookup(mdnsName);
import 'package:multicast_dns/multicast_dns.dart';
main() async {
final MDnsClient client = MDnsClient();
await client.start();
await for (final IPAddressResourceRecord ip
in client.lookup<IPAddressResourceRecord>(
ResourceRecordQuery.addressIPv4(mdnsName))) {
print('IP: ${ip.address.toString()}');
}
client.stop();
}Using Linux avahi-utils I can find it
$ avahi-resolve-host-name eWeLink_10013abc14.local
eWeLink_10013abc14.local 192.168.31.220
If I can know the serviceType (which I don't) I can use this
String serviceType = '_ewelink._tcp';
String mdnsName = 'eWeLink_10013abc14.local';
final MDnsClient client = MDnsClient();
await client.start();
await for (final PtrResourceRecord ptr in client.lookup<PtrResourceRecord>(
ResourceRecordQuery.serverPointer(serviceType))) {
print('PTR: ${ptr.toString()}');
await for (final IPAddressResourceRecord ip
in client.lookup<IPAddressResourceRecord>(
ResourceRecordQuery.addressIPv4(mdnsName))) {
print('IP: ${ip.address.toString()}');
}
}
client.stop();Proposal
Add a new function that can find SRV target IP or to what serviceType it belongs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: multicast_dnsThe mdns packageThe mdns packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team