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

Unified Diff: sdk/lib/io/http.dart

Issue 14640008: Change the signature for all network bind calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/io/http.dart
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
index 853b8581dc7a540144728dd33e5e04999117a9ce..6ea28efeb8f085bf298cb03a32824c2c9cf1d440 100644
--- a/sdk/lib/io/http.dart
+++ b/sdk/lib/io/http.dart
@@ -64,32 +64,51 @@ abstract class HttpServer implements Stream<HttpRequest> {
* Starts listening for HTTP requests on the specified [address] and
* [port].
*
- * The default value for [address] is 127.0.0.1, which will allow
- * only incoming connections from the local host. To allow for
- * incoming connection from the network use either the value 0.0.0.0
- * to bind to all interfaces or the IP address of a specific
- * interface.
+ * The [address] can either be a [String] or an
+ * [InternetAddress]. If [address] is a [String], [bind] will
+ * perform a [InternetAddress.lookup] and use the first value in the
+ * list. To listen on the loopback adapter, which will allow only
+ * incoming connections from the local host, use the value
+ * [InternetAddress.LOOPBACK_IP_V4] or
+ * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
+ * connection from the network use either one of the values
+ * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
+ * bind to all interfaces or the IP address of a specific interface.
*
- * If [port] has the value [:0:] (the default) an ephemeral port
- * will be chosen by the system. The actual port used can be
- * retrieved using the [:port:] getter.
+ * If [port] has the value [:0:] an ephemeral port will be chosen by
+ * the system. The actual port used can be retrieved using the
+ * [port] getter.
*
* The optional argument [backlog] can be used to specify the listen
* backlog for the underlying OS listen setup. If [backlog] has the
* value of [:0:] (the default) a reasonable value will be chosen by
* the system.
*/
- static Future<HttpServer> bind([String address = "127.0.0.1",
- int port = 0,
- int backlog = 0])
+ static Future<HttpServer> bind(address,
+ int port,
+ {int backlog: 0})
=> _HttpServer.bind(address, port, backlog);
/**
- * Starts listening for HTTPS requests on the specified [address] and
- * [port]. If a [port] of 0 is specified the server will choose an
- * ephemeral port. The optional argument [backlog] can be used to
- * specify the listen backlog for the underlying OS listen
- * setup.
+ * The [address] can either be a [String] or an
+ * [InternetAddress]. If [address] is a [String], [bind] will
+ * perform a [InternetAddress.lookup] and use the first value in the
+ * list. To listen on the loopback adapter, which will allow only
+ * incoming connections from the local host, use the value
+ * [InternetAddress.LOOPBACK_IP_V4] or
+ * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
+ * connection from the network use either one of the values
+ * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
+ * bind to all interfaces or the IP address of a specific interface.
+ *
+ * If [port] has the value [:0:] an ephemeral port will be chosen by
+ * the system. The actual port used can be retrieved using the
+ * [port] getter.
+ *
+ * The optional argument [backlog] can be used to specify the listen
+ * backlog for the underlying OS listen setup. If [backlog] has the
+ * value of [:0:] (the default) a reasonable value will be chosen by
+ * the system.
*
* The certificate with Distinguished Name [certificateName] is looked
* up in the certificate database, and is used as the server certificate.
@@ -97,7 +116,7 @@ abstract class HttpServer implements Stream<HttpRequest> {
* to authenticate with a client certificate.
*/
- static Future<HttpServer> bindSecure(String address,
+ static Future<HttpServer> bindSecure(address,
int port,
{int backlog: 0,
String certificateName,

Powered by Google App Engine
This is Rietveld 408576698