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

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

Issue 2946323002: Added timeout parameter to RawSocket and Socket connect, which allows for the specification of a ma… (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/io_patch.dart ('k') | tests/co19/co19-co19.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/socket.dart
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart
index bb39cd60c6f7d231a656f2e9ce14dff1882b8149..a6193d17b927c58ede94e55e5b50b2b1b926108d 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -424,8 +424,14 @@ abstract class RawSocket implements Stream<RawSocketEvent> {
* 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.
+ *
+ * The argument [timeout] is used to specify the maximum allowed time to wait
+ * for a connection to be established. If [timeout] is longer than the system
+ * level timeout duration, a timeout may occur sooner than specified in
+ * [timeout].
*/
- external static Future<RawSocket> connect(host, int port, {sourceAddress});
+ external static Future<RawSocket> connect(host, int port,
+ {sourceAddress, Duration timeout});
/**
* Returns the number of received and non-read bytes in the socket that
@@ -522,8 +528,14 @@ abstract class Socket implements Stream<List<int>>, IOSink {
* 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.
+ *
+ * The argument [timeout] is used to specify the maximum allowed time to wait
+ * for a connection to be established. If [timeout] is longer than the system
+ * level timeout duration, a timeout may occur sooner than specified in
+ * [timeout].
*/
- external static Future<Socket> connect(host, int port, {sourceAddress});
+ external static Future<Socket> connect(host, int port,
+ {sourceAddress, Duration timeout});
/**
* Destroy the socket in both directions. Calling [destroy] will make the
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/io_patch.dart ('k') | tests/co19/co19-co19.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698