| OLD | NEW |
| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 } | 530 } |
| 531 | 531 |
| 532 /** | 532 /** |
| 533 * A high-level class for communicating over a TCP socket. | 533 * A high-level class for communicating over a TCP socket. |
| 534 * | 534 * |
| 535 * The [Socket] exposes both a [Stream] and a [IOSink] interface, making it | 535 * The [Socket] exposes both a [Stream] and a [IOSink] interface, making it |
| 536 * ideal for using together with other [Stream]s. | 536 * ideal for using together with other [Stream]s. |
| 537 */ | 537 */ |
| 538 abstract class Socket implements Stream<List<int>>, IOSink { | 538 abstract class Socket implements Stream<List<int>>, IOSink { |
| 539 /** | 539 /** |
| 540 * Creats a new socket connection to the host and port and returns a [Future] | 540 * Creates a new socket connection to the host and port and returns a [Future] |
| 541 * that will complete with either a [Socket] once connected or an error | 541 * that will complete with either a [Socket] once connected or an error |
| 542 * if the host-lookup or connection failed. | 542 * if the host-lookup or connection failed. |
| 543 * | 543 * |
| 544 * [host] can either be a [String] or an [InternetAddress]. If [host] is a | 544 * [host] can either be a [String] or an [InternetAddress]. If [host] is a |
| 545 * [String], [connect] will perform a [InternetAddress.lookup] and try | 545 * [String], [connect] will perform a [InternetAddress.lookup] and try |
| 546 * all returned [InternetAddress]es, in turn, until connected. Unless a | 546 * all returned [InternetAddress]es, in turn, until connected. Unless a |
| 547 * connection was established, the error from the first attempt is | 547 * connection was established, the error from the first attempt is |
| 548 * returned. | 548 * returned. |
| 549 */ | 549 */ |
| 550 external static Future<Socket> connect(host, int port); | 550 external static Future<Socket> connect(host, int port); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 } | 740 } |
| 741 if (address != null) { | 741 if (address != null) { |
| 742 sb.write(", address = ${address.host}"); | 742 sb.write(", address = ${address.host}"); |
| 743 } | 743 } |
| 744 if (port != null) { | 744 if (port != null) { |
| 745 sb.write(", port = $port"); | 745 sb.write(", port = $port"); |
| 746 } | 746 } |
| 747 return sb.toString(); | 747 return sb.toString(); |
| 748 } | 748 } |
| 749 } | 749 } |
| OLD | NEW |