Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: pkg/mdns/lib/mdns.dart

Issue 1412063015: Improve resource record implementation in the mdns package. (Closed) Base URL: https://github.com/dart-lang/fletch.git@master
Patch Set: Remove unnecessary await. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/mdns/bin/mdns-sd.dart ('k') | pkg/mdns/lib/src/constants.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/mdns/lib/mdns.dart
diff --git a/pkg/mdns/lib/mdns.dart b/pkg/mdns/lib/mdns.dart
index 55682a7b4ca2c2360d0554cb504ef3c130f4e71f..d62c391909add65eaf4d23329b7f3c58f31c1984 100644
--- a/pkg/mdns/lib/mdns.dart
+++ b/pkg/mdns/lib/mdns.dart
@@ -11,6 +11,9 @@ import 'dart:typed_data';
import 'package:mdns/src/native_extension_client.dart';
import 'package:mdns/src/native_protocol_client.dart';
+import 'package:mdns/src/constants.dart';
+
+export 'package:mdns/src/constants.dart' show RRType;
/// Client for DNS lookup using the mDNS protocol.
///
@@ -44,22 +47,23 @@ abstract class MDnsClient {
/// Stop the mDNS client.
void stop();
- /// Lookup [hostname] using mDNS.
+ /// Query resource records with name [name] and type [type].
///
- /// The `hostname` must have the form `single-dns-label.local`,
- /// e.g. `printer.local`.
+ /// The [name] must be the fully qualified name (that is including
+ /// the domain '.local'); for example `printer.local`.
///
- /// If no answer has been received within the specified [timeout]
- /// this method will complete with the value `null`.
- Future<InternetAddress> lookup(
- String hostname, {Duration timeout: const Duration(seconds: 5)});
+ /// The stream is closed after the timeout is reached.
+ Stream<ResourceRecord> lookup(
+ int type,
+ String name,
+ {Duration timeout: const Duration(seconds: 5)});
}
// Simple standalone test.
Future main(List<String> args) async {
var client = new MDnsClient();
await client.start();
- var address = await client.lookup(args[0]);
- client.stop();
+ ResourceRecord resource = await client.lookup(RRType.A, args[0]).first;
print(address);
+ client.stop();
}
« no previous file with comments | « pkg/mdns/bin/mdns-sd.dart ('k') | pkg/mdns/lib/src/constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698