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

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

Issue 259353003: Make Socket::connect try all addresses given. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 * This is a one-shot listener, and writeEventsEnabled must be set 380 * This is a one-shot listener, and writeEventsEnabled must be set
381 * to true again to receive another write event. 381 * to true again to receive another write event.
382 */ 382 */
383 bool writeEventsEnabled; 383 bool writeEventsEnabled;
384 384
385 /** 385 /**
386 * Creates a new socket connection to the host and port and returns a [Future] 386 * Creates a new socket connection to the host and port and returns a [Future]
387 * that will complete with either a [RawSocket] once connected or an error 387 * that will complete with either a [RawSocket] once connected or an error
388 * if the host-lookup or connection failed. 388 * if the host-lookup or connection failed.
389 * 389 *
390 * [host] can either be a [String] or an [InternetAddress]. If [host] is a 390 * [host] can either be a [String], an [InternetAddress] or a [List] of
Søren Gjesse 2014/04/30 13:11:56 we don't want to support a list of InternetAddress
Anders Johnsen 2014/05/01 06:31:23 Done.
391 * [String], [connect] will perform a [InternetAddress.lookup] and use 391 * [InternetAddress]es. If [host] is a
392 * the first value in the list. 392 * [String], [connect] will perform a [InternetAddress.lookup] and try
393 * all returned [InternetAddress]es, in turn, until connected. If a connection
394 * was not possibly to any of the [InternetAddress]es, the error from the last
Ivan Posva 2014/04/30 16:28:06 possibly -> possible Or you might reword it a bit
Anders Johnsen 2014/05/01 06:31:23 Done.
395 * attempt is returned.
393 */ 396 */
394 external static Future<RawSocket> connect(host, int port); 397 external static Future<RawSocket> connect(host, int port);
395 398
396 /** 399 /**
397 * Returns the number of received and non-read bytes in the socket that 400 * Returns the number of received and non-read bytes in the socket that
398 * can be read. 401 * can be read.
399 */ 402 */
400 int available(); 403 int available();
401 404
402 /** 405 /**
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 * 474 *
472 * The [Socket] exposes both a [Stream] and a [IOSink] interface, making it 475 * The [Socket] exposes both a [Stream] and a [IOSink] interface, making it
473 * ideal for using together with other [Stream]s. 476 * ideal for using together with other [Stream]s.
474 */ 477 */
475 abstract class Socket implements Stream<List<int>>, IOSink { 478 abstract class Socket implements Stream<List<int>>, IOSink {
476 /** 479 /**
477 * Creats a new socket connection to the host and port and returns a [Future] 480 * Creats a new socket connection to the host and port and returns a [Future]
478 * that will complete with either a [Socket] once connected or an error 481 * that will complete with either a [Socket] once connected or an error
479 * if the host-lookup or connection failed. 482 * if the host-lookup or connection failed.
480 * 483 *
481 * [host] can either be a [String] or an [InternetAddress]. If [host] is a 484 * [host] can either be a [String], an [InternetAddress] or a [List] of
482 * [String], [connect] will perform a [InternetAddress.lookup] and use 485 * [InternetAddress]es. If [host] is a
483 * the first value in the list. 486 * [String], [connect] will perform a [InternetAddress.lookup] and try
487 * all returned [InternetAddress]es, in turn, until connected. If a connection
488 * was not possibly to any of the [InternetAddress]es, the error from the last
Ivan Posva 2014/04/30 16:28:06 ditto
Anders Johnsen 2014/05/01 06:31:23 Done.
489 * attempt is returned.
484 */ 490 */
485 external static Future<Socket> connect(host, int port); 491 external static Future<Socket> connect(host, int port);
486 492
487 /** 493 /**
488 * Destroy the socket in both directions. Calling [destroy] will make the 494 * Destroy the socket in both directions. Calling [destroy] will make the
489 * send a close event on the stream and will no longer react on data being 495 * send a close event on the stream and will no longer react on data being
490 * piped to it. 496 * piped to it.
491 * 497 *
492 * Call [close](inherited from [IOSink]) to only close the [Socket] 498 * Call [close](inherited from [IOSink]) to only close the [Socket]
493 * for sending data. 499 * for sending data.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 } 681 }
676 if (address != null) { 682 if (address != null) {
677 sb.write(", address = ${address.host}"); 683 sb.write(", address = ${address.host}");
678 } 684 }
679 if (port != null) { 685 if (port != null) {
680 sb.write(", port = $port"); 686 sb.write(", port = $port");
681 } 687 }
682 return sb.toString(); 688 return sb.toString();
683 } 689 }
684 } 690 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698