| 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 * [InternetAddressType] is the type an [InternetAddress]. Currently, | 8 * [InternetAddressType] is the type an [InternetAddress]. Currently, |
| 9 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. | 9 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. |
| 10 */ | 10 */ |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 * [host] can either be a [String] or an [InternetAddress]. If [host] is a | 417 * [host] can either be a [String] or an [InternetAddress]. If [host] is a |
| 418 * [String], [connect] will perform a [InternetAddress.lookup] and try | 418 * [String], [connect] will perform a [InternetAddress.lookup] and try |
| 419 * all returned [InternetAddress]es, until connected. Unless a | 419 * all returned [InternetAddress]es, until connected. Unless a |
| 420 * connection was established, the error from the first failing connection is | 420 * connection was established, the error from the first failing connection is |
| 421 * returned. | 421 * returned. |
| 422 * | 422 * |
| 423 * The argument [sourceAddress] can be used to specify the local | 423 * The argument [sourceAddress] can be used to specify the local |
| 424 * address to bind when making the connection. `sourceAddress` can either | 424 * address to bind when making the connection. `sourceAddress` can either |
| 425 * be a `String` or an `InternetAddress`. If a `String` is passed it must | 425 * be a `String` or an `InternetAddress`. If a `String` is passed it must |
| 426 * hold a numeric IP address. | 426 * hold a numeric IP address. |
| 427 * |
| 428 * The argument [timeout] is used to specify the maximum allowed time to wait |
| 429 * for a connection to be established. If [timeout] is longer than the system |
| 430 * level timeout duration, a timeout may occur sooner than specified in |
| 431 * [timeout]. |
| 427 */ | 432 */ |
| 428 external static Future<RawSocket> connect(host, int port, {sourceAddress}); | 433 external static Future<RawSocket> connect(host, int port, |
| 434 {sourceAddress, Duration timeout}); |
| 429 | 435 |
| 430 /** | 436 /** |
| 431 * Returns the number of received and non-read bytes in the socket that | 437 * Returns the number of received and non-read bytes in the socket that |
| 432 * can be read. | 438 * can be read. |
| 433 */ | 439 */ |
| 434 int available(); | 440 int available(); |
| 435 | 441 |
| 436 /** | 442 /** |
| 437 * Read up to [len] bytes from the socket. This function is | 443 * Read up to [len] bytes from the socket. This function is |
| 438 * non-blocking and will only return data if data is available. The | 444 * non-blocking and will only return data if data is available. The |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 * [host] can either be a [String] or an [InternetAddress]. If [host] is a | 521 * [host] can either be a [String] or an [InternetAddress]. If [host] is a |
| 516 * [String], [connect] will perform a [InternetAddress.lookup] and try | 522 * [String], [connect] will perform a [InternetAddress.lookup] and try |
| 517 * all returned [InternetAddress]es, until connected. Unless a | 523 * all returned [InternetAddress]es, until connected. Unless a |
| 518 * connection was established, the error from the first failing connection is | 524 * connection was established, the error from the first failing connection is |
| 519 * returned. | 525 * returned. |
| 520 * | 526 * |
| 521 * The argument [sourceAddress] can be used to specify the local | 527 * The argument [sourceAddress] can be used to specify the local |
| 522 * address to bind when making the connection. `sourceAddress` can either | 528 * address to bind when making the connection. `sourceAddress` can either |
| 523 * be a `String` or an `InternetAddress`. If a `String` is passed it must | 529 * be a `String` or an `InternetAddress`. If a `String` is passed it must |
| 524 * hold a numeric IP address. | 530 * hold a numeric IP address. |
| 531 * |
| 532 * The argument [timeout] is used to specify the maximum allowed time to wait |
| 533 * for a connection to be established. If [timeout] is longer than the system |
| 534 * level timeout duration, a timeout may occur sooner than specified in |
| 535 * [timeout]. |
| 525 */ | 536 */ |
| 526 external static Future<Socket> connect(host, int port, {sourceAddress}); | 537 external static Future<Socket> connect(host, int port, |
| 538 {sourceAddress, Duration timeout}); |
| 527 | 539 |
| 528 /** | 540 /** |
| 529 * Destroy the socket in both directions. Calling [destroy] will make the | 541 * Destroy the socket in both directions. Calling [destroy] will make the |
| 530 * send a close event on the stream and will no longer react on data being | 542 * send a close event on the stream and will no longer react on data being |
| 531 * piped to it. | 543 * piped to it. |
| 532 * | 544 * |
| 533 * Call [close](inherited from [IOSink]) to only close the [Socket] | 545 * Call [close](inherited from [IOSink]) to only close the [Socket] |
| 534 * for sending data. | 546 * for sending data. |
| 535 */ | 547 */ |
| 536 void destroy(); | 548 void destroy(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 } | 736 } |
| 725 if (address != null) { | 737 if (address != null) { |
| 726 sb.write(", address = ${address.host}"); | 738 sb.write(", address = ${address.host}"); |
| 727 } | 739 } |
| 728 if (port != null) { | 740 if (port != null) { |
| 729 sb.write(", port = $port"); | 741 sb.write(", port = $port"); |
| 730 } | 742 } |
| 731 return sb.toString(); | 743 return sb.toString(); |
| 732 } | 744 } |
| 733 } | 745 } |
| OLD | NEW |