| 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, IPv4 and | 9 * [InternetAddressType] is the type an [InternetAddress]. Currently, IPv4 and |
| 10 * IPv6 are supported. | 10 * IPv6 are supported. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 */ | 61 */ |
| 62 String get host; | 62 String get host; |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Lookup a host, returning a Future of a list of [InternetAddress]s. If | 65 * Lookup a host, returning a Future of a list of [InternetAddress]s. If |
| 66 * [type] is [InternetAddressType.ANY], it will lookup both IPv4 and IPv6 | 66 * [type] is [InternetAddressType.ANY], it will lookup both IPv4 and IPv6 |
| 67 * addresses. The order of the list depends on the local machine and the DNS | 67 * addresses. The order of the list depends on the local machine and the DNS |
| 68 * lookup performed, and can as such change over time. | 68 * lookup performed, and can as such change over time. |
| 69 */ | 69 */ |
| 70 external static Future<List<InternetAddress>> lookup( | 70 external static Future<List<InternetAddress>> lookup( |
| 71 String host, {InternetAddressType type: InternetAddressType.ANY}); | 71 String host, {InternetAddressType type: InternetAddressType.IPv4}); |
| 72 } | 72 } |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * The RawServerSocket is a server socket, providing a stream of low-level | 75 * The RawServerSocket is a server socket, providing a stream of low-level |
| 76 * [RawSocket]s. | 76 * [RawSocket]s. |
| 77 * | 77 * |
| 78 * See [RawSocket] for more info. | 78 * See [RawSocket] for more info. |
| 79 */ | 79 */ |
| 80 abstract class RawServerSocket implements Stream<RawSocket> { | 80 abstract class RawServerSocket implements Stream<RawSocket> { |
| 81 /** | 81 /** |
| 82 * Returns a future for a [:RawServerSocket:]. When the future | 82 * Returns a future for a [:RawServerSocket:]. When the future |
| 83 * completes the server socket is bound to the given [address] and | 83 * completes the server socket is bound to the given [address] and |
| 84 * [port] and has started listening on it. | 84 * [port] and has started listening on it. |
| 85 * | 85 * |
| 86 * The default value for [address] is 127.0.0.1, which will allow | 86 * The default value for [address] is 127.0.0.1, which will allow |
| 87 * only incoming connections from the local host. To allow for | 87 * only incoming connections from the local host. To allow for |
| 88 * incoming connection from the network use either the value 0.0.0.0 | 88 * incoming connection from the network use either the value 0.0.0.0 |
| 89 * to bind to all interfaces or the IP address of a specific | 89 * to bind to all interfaces or the IP address of a specific |
| 90 * interface. | 90 * interface. |
| 91 * | 91 * |
| 92 * If [port] has the value [:0:] (the default) an ephemeral port will | 92 * If [port] has the value [:0:] (the default) an ephemeral port will |
| 93 * be chosen by the system. The actual port used can be retrieved | 93 * be chosen by the system. The actual port used can be retrieved |
| 94 * using the [:port:] getter. | 94 * using the [:port:] getter. |
| 95 * | 95 * |
| 96 * The optional argument [backlog] can be used to specify the listen | 96 * The optional argument [backlog] can be used to specify the listen |
| 97 * backlog for the underlying OS listen setup. If [backlog] has the | 97 * backlog for the underlying OS listen setup. If [backlog] has the |
| 98 * value of [:0:] (the default) a reasonable value will be chosen by | 98 * value of [:0:] (the default) a reasonable value will be chosen by |
| 99 * the system. | 99 * the system. |
| 100 */ | 100 */ |
| 101 external static Future<RawServerSocket> bind([String address = "127.0.0.1", | 101 external static Future<RawServerSocket> bind([address = "127.0.0.1", |
| 102 int port = 0, | 102 int port = 0, |
| 103 int backlog = 0]); | 103 int backlog = 0]); |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Returns the port used by this socket. | 106 * Returns the port used by this socket. |
| 107 */ | 107 */ |
| 108 int get port; | 108 int get port; |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Closes the socket. | 111 * Closes the socket. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 134 * | 134 * |
| 135 * If [port] has the value [:0:] (the default) an ephemeral port will | 135 * If [port] has the value [:0:] (the default) an ephemeral port will |
| 136 * be chosen by the system. The actual port used can be retrieved | 136 * be chosen by the system. The actual port used can be retrieved |
| 137 * using the [port] getter. | 137 * using the [port] getter. |
| 138 * | 138 * |
| 139 * The optional argument [backlog] can be used to specify the listen | 139 * The optional argument [backlog] can be used to specify the listen |
| 140 * backlog for the underlying OS listen setup. If [backlog] has the | 140 * backlog for the underlying OS listen setup. If [backlog] has the |
| 141 * value of [:0:] (the default) a reasonable value will be chosen by | 141 * value of [:0:] (the default) a reasonable value will be chosen by |
| 142 * the system. | 142 * the system. |
| 143 */ | 143 */ |
| 144 external static Future<ServerSocket> bind([String address = "127.0.0.1", | 144 external static Future<ServerSocket> bind([address = "127.0.0.1", |
| 145 int port = 0, | 145 int port = 0, |
| 146 int backlog = 0]); | 146 int backlog = 0]); |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * Returns the port used by this socket. | 149 * Returns the port used by this socket. |
| 150 */ | 150 */ |
| 151 int get port; | 151 int get port; |
| 152 | 152 |
| 153 /** | 153 /** |
| 154 * Closes the socket. | 154 * Closes the socket. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 sb.write(" ($osError)"); | 368 sb.write(" ($osError)"); |
| 369 } | 369 } |
| 370 } else if (osError != null) { | 370 } else if (osError != null) { |
| 371 sb.write(": $osError"); | 371 sb.write(": $osError"); |
| 372 } | 372 } |
| 373 return sb.toString(); | 373 return sb.toString(); |
| 374 } | 374 } |
| 375 final String message; | 375 final String message; |
| 376 final OSError osError; | 376 final OSError osError; |
| 377 } | 377 } |
| OLD | NEW |