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

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: Fix Windows build 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});
/**
* 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

Powered by Google App Engine
This is Rietveld 408576698