Open DartBot opened 9 years ago
Added Area-Library, Library-IO, Triaged labels.
Seems like something that can reasonably be put in a separate package.
I think a DNS client implementation can be done as a package using dart:io
Can the lookups be done using OS calls? If so, the functionality would fit into dart:io. If it needs to send UDP packets to a server, it might as well be done in a dns-client package (but then dart:io might still want to provide the IP address of the DNS server of the system).
This comment was originally written by @kaendfinger
I believe it is done via OS calls, well, native library calls.
Linux: http://linux.die.net/man/3/res_query
I'm not sure about other platforms yet.
Hello ! Is there are solution for this ? At the moment i need to check the TXT record from a certain domain.
Any idea how to solve this or is there something like dnsjava?
Since it will take even longer for this function to be implemented, I have written a small helper class that can be used to query a record. It uses the google dns resolver api to fetch the records. I added this helper class to my helper class collection :
https://github.com/Ephenodrom/Dart-Basic-Utils
Add the following line to your pubspec.yaml
dependencies:
basic_utils: ^1.0.6
Usage :
List<RRecord> records = await DnsUtils.lookupRecord("google.de", RRecordType.TXT);
Since it uses the google api, it should also work with the flutter framework!
List<RRecord> records = await DnsUtils.lookupRecord("google.de", RRecordType.TXT);
Works like a charm!
InternetAddress.lookup('github.com').then((value) {
value.forEach((element) async {
print('element.address: ${element.address}');
});
});
InternetAddress.lookup('github.com').then((value) { value.forEach((element) async { print('element.address: ${element.address}'); }); });
Is there a way to cancel dns request (or more precicelly - to close its socket) while it's in progress?
@yvs2014 Both the method of canceling Future
and the method of canceling future still apply. You can refer to: https://stackoverflow.com/questions/17552757/is-there-any-way-to-cancel-a-dart-future
@0x1af2aec8f957 does cancelling Future
close underlying sockets opened at resolving?
@yvs2014 This method only cancels the final result, and Dart
lacks relevant documentation for closing or canceling the underlying socket.
@0x1af2aec8f957 so, in this case it's not helpful, because that async operation will continue. The ways known to me how to enforce closing underlying sockets: [1] close app with exit(3), but it's not always acceptable [2] place lookup calls into a separate thread (with isolate for ex), and kill that thread (as a variety of [1])
Just tried to find out a bit more direct and easy way how to close them
This issue was originally filed by @kaendfinger
NodeJS provides a DNS module that allows you to lookup records on domains. Dart should provide this functionality out of the box.
See https://nodejs.org/api/dns.html
Justification:
Some developers may want to write something like a thing to check if a domain has a TXT record. How would a developer do this now:
Solution: Implement a DNS Client API in dart:io