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

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

Issue 908873002: Add support to specify the source address for socket connect (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added dart2js patch file Created 5 years, 10 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/socket.dart
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart
index b95163c5567765976e6eea3c6c7635e37e82c0f8..70c68a0ecf066dea8362755bcf7bc5236101da22 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -453,8 +453,13 @@ abstract class RawSocket implements Stream<RawSocketEvent> {
* all returned [InternetAddress]es, until connected. Unless a
* connection was established, the error from the first failing connection is
* returned.
+ *
+ * The argument [sourceAddress] can be used to specify the local
+ * address to bind when making the connection. `sourceAddress` can either
+ * be a `String` or an `InternetAddress`. If a `String` is passed it must
+ * hold a numeric IP address.
*/
- external static Future<RawSocket> connect(host, int port);
+ external static Future<RawSocket> connect(host, int port, {sourceAddress});
kevmoo 2015/02/10 15:07:08 What's the expected format of `sourceAddress` if n
kustermann 2015/02/10 15:15:37 Because it's much more convenient to write. It's a
Søren Gjesse 2015/02/11 10:12:22 I thought about this, and with the first argument
/**
* Returns the number of received and non-read bytes in the socket that
@@ -546,8 +551,13 @@ abstract class Socket implements Stream<List<int>>, IOSink {
* all returned [InternetAddress]es, until connected. Unless a
* connection was established, the error from the first failing connection is
* returned.
+ *
+ * The argument [sourceAddress] can be used to specify the local
+ * address to bind when making the connection. `sourceAddress` can either
+ * be a `String` or an `InternetAddress`. If a `String` is passed it must
+ * hold a numeric IP address.
*/
- external static Future<Socket> connect(host, int port);
+ external static Future<Socket> connect(host, int port, {sourceAddress});
/**
* Destroy the socket in both directions. Calling [destroy] will make the
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/io_patch.dart ('k') | tests/standalone/io/socket_source_address_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698