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

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

Issue 2946333002: Added timeout parameter to RawSocket and Socket connect, which allows for the specification of a ma… (Closed)
Patch Set: Updated CHANGELOG.md 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/standalone/io/socket_test.dart » ('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..4ece18658bab624b9cc944798c5fc604df823fc1 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -424,8 +424,15 @@ 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]. On timeout, a [SocketException] is thrown and all ongoing
+ * connection attempts to [host] are cancelled.
*/
- 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 +529,15 @@ 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]. On timeout, a [SocketException] is thrown and all ongoing
+ * connection attempts to [host] are cancelled.
*/
- 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/standalone/io/socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698