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

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

Issue 1407123010: Extend the mDNS package with a native extension used on Mac OS (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Addressed review comments Created 5 years, 2 months 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/lib/src/native_extension_client.dart ('k') | pkg/mdns/test/decode_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/mdns/lib/src/native_protocol_client.dart
diff --git a/pkg/mdns/lib/mdns.dart b/pkg/mdns/lib/src/native_protocol_client.dart
similarity index 74%
copy from pkg/mdns/lib/mdns.dart
copy to pkg/mdns/lib/src/native_protocol_client.dart
index f707136d4c865cb33b8b6f39c022af0af5fbd5f7..23854300ee9281e44c4dac70c3755474579346bb 100644
--- a/pkg/mdns/lib/mdns.dart
+++ b/pkg/mdns/lib/src/native_protocol_client.dart
@@ -1,21 +1,20 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
+// BSD-style license that can be found in the LICENSE.md file.
+
+library mdns.src.native_protocol_client;
import 'dart:async';
import 'dart:collection';
import 'dart:io';
-import 'dart:typed_data';
+import 'package:mdns/mdns.dart';
import 'package:mdns/src/constants.dart';
import 'package:mdns/src/lookup_resolver.dart';
import 'package:mdns/src/packet.dart';
-/// Client for DNS lookup using the mDNS protocol.
-///
-/// This client only support "One-Shot Multicast DNS Queries" as described in
-/// section 5.1 of https://tools.ietf.org/html/rfc6762
-class MDnsClient {
+// Implementation of mDNS client using the native protocol.
+class NativeProtocolMDnsClient implements MDnsClient {
bool _starting = false;
bool _started = false;
RawDatagramSocket _incoming;
@@ -51,7 +50,6 @@ class MDnsClient {
_started = true;
}
- /// Stop the mDNS client.
void stop() {
if (!_started) return;
if (_starting) {
@@ -64,13 +62,6 @@ class MDnsClient {
_started = false;
}
- /// Lookup [hostname] using mDNS.
- ///
- /// The `hostname` must have the form `single-dns-label.local`,
- /// e.g. `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)}) {
if (!_started) {
@@ -100,12 +91,3 @@ class MDnsClient {
}
}
}
-
-// Simple standalone test.
-main() async {
- var client = new MDnsClient();
- await client.start();
- var address = await client.lookup('raspberrypi.local');
- client.stop();
- print(address);
-}
« no previous file with comments | « pkg/mdns/lib/src/native_extension_client.dart ('k') | pkg/mdns/test/decode_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698