OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 | 7 |
8 /** | 8 /** |
9 * [InternetAddressType] is the type an [InternetAddress]. Currently, | 9 * [InternetAddressType] is the type an [InternetAddress]. Currently, |
10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. | 10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 /** | 237 /** |
238 * Returns the address used by this socket. | 238 * Returns the address used by this socket. |
239 */ | 239 */ |
240 InternetAddress get address; | 240 InternetAddress get address; |
241 | 241 |
242 /** | 242 /** |
243 * Closes the socket. The returned future completes when the socket | 243 * Closes the socket. The returned future completes when the socket |
244 * is fully closed and is no longer bound. | 244 * is fully closed and is no longer bound. |
245 */ | 245 */ |
246 Future<RawServerSocket> close(); | 246 Future<RawServerSocket> close(); |
247 | |
248 /** | |
249 * Clone a [RawServerSocket]. | |
250 * | |
251 * Returns a [RawServerSocketHandle] that can be sent to other isolates. To | |
Lasse Reichstein Nielsen
2014/04/24 12:46:47
This feels wrong.
It seems there is some underlyi
Søren Gjesse
2014/04/25 12:24:44
We already discussed that the naming is difficult.
| |
252 * listen on the cloned [RawServerSocket], first call | |
253 * [ServerSocketHandle.acquire] to get the actual [RawServerSocket]. | |
254 * | |
255 * All cloned [RawServerSocket]s will receive incoming [Socket]s using a | |
256 * round-robin approach. | |
257 * | |
258 * WARNING: This feature is highly *experimental* and currently only works on | |
259 * Linux. The API is most likely going to change in the near future. | |
260 */ | |
261 RawServerSocketHandle clone(); | |
247 } | 262 } |
248 | 263 |
249 | 264 |
265 /** | |
266 * A [RawServerSocketHandle]. | |
267 * | |
268 * See [RawServerSocket.clone] for more information. | |
269 */ | |
270 abstract class RawServerSocketHandle { | |
271 /** | |
272 * Acquire the cloned [RawServerSocket]. | |
273 * | |
274 * After a call to [acquire], the [RawServerSocketHandle] object is no longer | |
275 * valid. | |
276 */ | |
277 Future<RawServerSocket> acquire(); | |
278 } | |
279 | |
280 | |
250 /** | 281 /** |
251 * A [ServerSocket] represents a listening socket, and provides a | 282 * A [ServerSocket] represents a listening socket, and provides a |
252 * stream of [Socket] objects, one for each connection made to the | 283 * stream of [Socket] objects, one for each connection made to the |
253 * listening socket. | 284 * listening socket. |
254 * | 285 * |
255 * See [Socket] for more info. | 286 * See [Socket] for more info. |
256 */ | 287 */ |
257 abstract class ServerSocket implements Stream<Socket> { | 288 abstract class ServerSocket implements Stream<Socket> { |
258 /** | 289 /** |
259 * Returns a future for a [:ServerSocket:]. When the future | 290 * Returns a future for a [:ServerSocket:]. When the future |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 /** | 329 /** |
299 * Returns the address used by this socket. | 330 * Returns the address used by this socket. |
300 */ | 331 */ |
301 InternetAddress get address; | 332 InternetAddress get address; |
302 | 333 |
303 /** | 334 /** |
304 * Closes the socket. The returned future completes when the socket | 335 * Closes the socket. The returned future completes when the socket |
305 * is fully closed and is no longer bound. | 336 * is fully closed and is no longer bound. |
306 */ | 337 */ |
307 Future<ServerSocket> close(); | 338 Future<ServerSocket> close(); |
339 | |
340 /** | |
341 * Clone a [ServerSocket]. | |
342 * | |
343 * Returns a [ServerSocketHandle] that can be sent to other isolates. To | |
344 * listen on the cloned [ServerSocket], first call | |
345 * [ServerSocketHandle.acquire] to get the actual [ServerSocket]. | |
346 * | |
347 * All cloned [ServerSocket]s will receive incoming [Socket]s using a | |
348 * round-robin approach. | |
349 * | |
350 * WARNING: This feature is highly *experimental* and currently only works on | |
351 * Linux. The API is most likely going to change in the near future. | |
352 */ | |
353 ServerSocketHandle clone(); | |
308 } | 354 } |
309 | 355 |
356 | |
357 /** | |
358 * A [ServerSocketHandle]. | |
359 * | |
360 * See [ServerSocket.clone] for more information. | |
361 */ | |
362 abstract class ServerSocketHandle { | |
363 /** | |
364 * Acquire the cloned [ServerSocket]. | |
365 * | |
366 * After a call to [acquire], the [ServerSocketHandle] object is no longer | |
367 * valid. | |
368 */ | |
369 Future<ServerSocket> acquire(); | |
370 } | |
371 | |
372 | |
310 /** | 373 /** |
311 * The [SocketDirection] is used as a parameter to [Socket.close] and | 374 * The [SocketDirection] is used as a parameter to [Socket.close] and |
312 * [RawSocket.close] to close a socket in the specified direction(s). | 375 * [RawSocket.close] to close a socket in the specified direction(s). |
313 */ | 376 */ |
314 class SocketDirection { | 377 class SocketDirection { |
315 static const SocketDirection RECEIVE = const SocketDirection._(0); | 378 static const SocketDirection RECEIVE = const SocketDirection._(0); |
316 static const SocketDirection SEND = const SocketDirection._(1); | 379 static const SocketDirection SEND = const SocketDirection._(1); |
317 static const SocketDirection BOTH = const SocketDirection._(2); | 380 static const SocketDirection BOTH = const SocketDirection._(2); |
318 final _value; | 381 final _value; |
319 | 382 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
675 } | 738 } |
676 if (address != null) { | 739 if (address != null) { |
677 sb.write(", address = ${address.host}"); | 740 sb.write(", address = ${address.host}"); |
678 } | 741 } |
679 if (port != null) { | 742 if (port != null) { |
680 sb.write(", port = $port"); | 743 sb.write(", port = $port"); |
681 } | 744 } |
682 return sb.toString(); | 745 return sb.toString(); |
683 } | 746 } |
684 } | 747 } |
OLD | NEW |