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

Side by Side Diff: sdk/lib/io/socket.dart

Issue 16514010: Add NetworkAdaptor to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review update. Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/vmstats_impl.cc ('k') | tests/standalone/io/internet_address_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 7
8 /** 8 /**
9 * [InternetAddressType] is the type an [InternetAddress]. Currently, 9 * [InternetAddressType] is the type an [InternetAddress]. Currently,
10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. 10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 * The resolved address of the host. 80 * The resolved address of the host.
81 */ 81 */
82 String get address; 82 String get address;
83 83
84 /** 84 /**
85 * The host used to lookup the address. 85 * The host used to lookup the address.
86 */ 86 */
87 String get host; 87 String get host;
88 88
89 /** 89 /**
90 * Returns true if the [InternetAddress] is a loopback address.
91 */
92 bool get isLoopback;
93
94 /**
95 * Returns true if the [InternetAddress]s scope is a link-local.
96 */
97 bool get isLinkLocal;
98
99 /**
90 * Lookup a host, returning a Future of a list of 100 * Lookup a host, returning a Future of a list of
91 * [InternetAddress]s. If [type] is [InternetAddressType.ANY], it 101 * [InternetAddress]s. If [type] is [InternetAddressType.ANY], it
92 * will lookup both IP version 4 (IPv4) and IP version 6 (IPv6) 102 * will lookup both IP version 4 (IPv4) and IP version 6 (IPv6)
93 * addresses. If [type] is either [InternetAddressType.IP_V4] or 103 * addresses. If [type] is either [InternetAddressType.IP_V4] or
94 * [InternetAddressType.IP_V6] it will only lookup addresses of the 104 * [InternetAddressType.IP_V6] it will only lookup addresses of the
95 * specified type. The order of the list can, and most likely will, 105 * specified type. The order of the list can, and most likely will,
96 * change over time. 106 * change over time.
97 */ 107 */
98 external static Future<List<InternetAddress>> lookup( 108 external static Future<List<InternetAddress>> lookup(
99 String host, {InternetAddressType type: InternetAddressType.ANY}); 109 String host, {InternetAddressType type: InternetAddressType.ANY});
100 } 110 }
101 111
112
113 /**
114 * A [NetworkInterface] represent an active network interface on the current
115 * system. It contains a list of [InternetAddress]s, that's bound to the
116 * interface.
117 */
118 class NetworkInterface {
119 /**
120 * Get the name of the [NetworkInterface].
121 */
122 String get name;
123
124 /**
125 * Get a list of [InternetAddress]s currently bound to this
126 * [NetworkInterface].
127 */
128 List<InternetAddress> get addresses;
129
130 /**
131 * Query the system for [NetworkInterface]s.
132 *
133 * If [includeLoopback] is `true`, the returned list will include the
134 * loopback device. Default is `false`.
135 *
136 * If [includeLinkLocal] is `true`, the list of addresses of the returned
137 * [NetworkInterface]s, may include link local addresses. Default is `false`.
138 *
139 * If [type] is either [InternetAddressType.IP_V4] or
140 * [InternetAddressType.IP_V6] it will only lookup addresses of the
141 * specified type. Default is [InternetAddressType.ANY].
142 */
143 external static Future<List<NetworkInterface>> list({
144 bool includeLoopback: false,
145 bool includeLinkLocal: false,
146 InternetAddressType type: InternetAddressType.ANY});
147 }
148
149
102 /** 150 /**
103 * A [RawServerSocket] represents a listening socket, and provides a 151 * A [RawServerSocket] represents a listening socket, and provides a
104 * stream of low-level [RawSocket] objects, one for each connection 152 * stream of low-level [RawSocket] objects, one for each connection
105 * made to the listening socket. 153 * made to the listening socket.
106 * 154 *
107 * See [RawSocket] for more info. 155 * See [RawSocket] for more info.
108 */ 156 */
109 abstract class RawServerSocket implements Stream<RawSocket> { 157 abstract class RawServerSocket implements Stream<RawSocket> {
110 /** 158 /**
111 * Returns a future for a [:RawServerSocket:]. When the future 159 * Returns a future for a [:RawServerSocket:]. When the future
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 sb.write(" ($osError)"); 469 sb.write(" ($osError)");
422 } 470 }
423 } else if (osError != null) { 471 } else if (osError != null) {
424 sb.write(": $osError"); 472 sb.write(": $osError");
425 } 473 }
426 return sb.toString(); 474 return sb.toString();
427 } 475 }
428 final String message; 476 final String message;
429 final OSError osError; 477 final OSError osError;
430 } 478 }
OLDNEW
« no previous file with comments | « runtime/bin/vmstats_impl.cc ('k') | tests/standalone/io/internet_address_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698