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

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

Issue 250513002: Add support for cloning server-sockets. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review feedback. Created 6 years, 7 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/socket_patch.dart ('k') | no next file » | 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 /** 237 /**
238 * Returns the address used by this socket. 238 * Returns the address used by this socket.
239 */ 239 */
240 InternetAddress get address; 240 InternetAddress get address;
241 241
242 /** 242 /**
243 * Closes the socket. The returned future completes when the socket 243 * Closes the socket. The returned future completes when the socket
244 * is fully closed and is no longer bound. 244 * is fully closed and is no longer bound.
245 */ 245 */
246 Future<RawServerSocket> close(); 246 Future<RawServerSocket> close();
247
248 /**
249 * Get the [RawServerSocketReference].
250 *
251 * WARNING: This feature is *highly experimental* and currently only works on
252 * Linux. The API is most likely going to change in the near future.
253 *
254 * The returned [RawServerSocketReference] can be used to create other
255 * [RawServerSocket]s listening on the same port,
256 * using [RawServerSocketReference.create].
257 * Incoming connections on the port will be distributed fairly between the
258 * active server sockets.
259 * The [RawServerSocketReference] can be distributed to other isolates through
260 * a [RawSendPort].
261 */
262 RawServerSocketReference get reference;
247 } 263 }
248 264
249 265
266 /**
267 * A [RawServerSocketReference].
268 *
269 * WARNING: This class is used with [RawServerSocket.reference] which is highly
270 * experimental.
271 */
272 abstract class RawServerSocketReference {
273 /**
274 * Create a new [RawServerSocket], from this reference.
275 */
276 Future<RawServerSocket> create();
277 }
278
279
250 /** 280 /**
251 * A [ServerSocket] represents a listening socket, and provides a 281 * A [ServerSocket] represents a listening socket, and provides a
252 * stream of [Socket] objects, one for each connection made to the 282 * stream of [Socket] objects, one for each connection made to the
253 * listening socket. 283 * listening socket.
254 * 284 *
255 * See [Socket] for more info. 285 * See [Socket] for more info.
256 */ 286 */
257 abstract class ServerSocket implements Stream<Socket> { 287 abstract class ServerSocket implements Stream<Socket> {
258 /** 288 /**
259 * Returns a future for a [:ServerSocket:]. When the future 289 * Returns a future for a [:ServerSocket:]. When the future
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 /** 328 /**
299 * Returns the address used by this socket. 329 * Returns the address used by this socket.
300 */ 330 */
301 InternetAddress get address; 331 InternetAddress get address;
302 332
303 /** 333 /**
304 * Closes the socket. The returned future completes when the socket 334 * Closes the socket. The returned future completes when the socket
305 * is fully closed and is no longer bound. 335 * is fully closed and is no longer bound.
306 */ 336 */
307 Future<ServerSocket> close(); 337 Future<ServerSocket> close();
338
339 /**
340 * Get the [ServerSocketReference].
341 *
342 * WARNING: This feature is *highly experimental* and currently only works on
343 * Linux. The API is most likely going to change in the near future.
344 *
345 * The returned [ServerSocketReference] can be used to create other
346 * [ServerSocket]s listening on the same port,
347 * using [ServerSocketReference.create].
348 * Incoming connections on the port will be distributed fairly between the
349 * active server sockets.
350 * The [ServerSocketReference] can be distributed to other isolates through a
351 * [SendPort].
352 */
353 ServerSocketReference get reference;
308 } 354 }
309 355
356
357 /**
358 * A [ServerSocketReference].
359 *
360 * WARNING: This class is used with [ServerSocket.reference] which is highly
361 * experimental.
362 */
363 abstract class ServerSocketReference {
364 /**
365 * Create a new [ServerSocket], from this reference.
366 */
367 Future<ServerSocket> create();
368 }
369
370
310 /** 371 /**
311 * The [SocketDirection] is used as a parameter to [Socket.close] and 372 * The [SocketDirection] is used as a parameter to [Socket.close] and
312 * [RawSocket.close] to close a socket in the specified direction(s). 373 * [RawSocket.close] to close a socket in the specified direction(s).
313 */ 374 */
314 class SocketDirection { 375 class SocketDirection {
315 static const SocketDirection RECEIVE = const SocketDirection._(0); 376 static const SocketDirection RECEIVE = const SocketDirection._(0);
316 static const SocketDirection SEND = const SocketDirection._(1); 377 static const SocketDirection SEND = const SocketDirection._(1);
317 static const SocketDirection BOTH = const SocketDirection._(2); 378 static const SocketDirection BOTH = const SocketDirection._(2);
318 final _value; 379 final _value;
319 380
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 740 }
680 if (address != null) { 741 if (address != null) {
681 sb.write(", address = ${address.host}"); 742 sb.write(", address = ${address.host}");
682 } 743 }
683 if (port != null) { 744 if (port != null) {
684 sb.write(", port = $port"); 745 sb.write(", port = $port");
685 } 746 }
686 return sb.toString(); 747 return sb.toString();
687 } 748 }
688 } 749 }
OLDNEW
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698