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 * Get the [RawServerSocketReference]. | |
250 * | |
251 * The reference can be used to clone this [RawServerSocket] onto multiple | |
252 * isolates. See [RawServerSocketReference] for more information. | |
253 * | |
254 * All cloned [RawServerSocket]s will receive incoming [RawSocket]s using a | |
255 * round-robin approach. | |
256 * | |
257 * WARNING: This feature is highly *experimental* and currently only works on | |
Søren Gjesse
2014/05/06 08:47:39
Move the WARNING up as the first line of the comme
Anders Johnsen
2014/05/06 12:34:32
Done.
| |
258 * Linux. The API is most likely going to change in the near future. | |
259 */ | |
260 RawServerSocketReference get reference; | |
247 } | 261 } |
248 | 262 |
249 | 263 |
264 /** | |
Søren Gjesse
2014/05/06 08:47:39
Add a WARNING here as well.
WARNING: This class i
Anders Johnsen
2014/05/06 12:34:32
Done.
| |
265 * A [RawServerSocketReference]. | |
266 * | |
267 * See [RawServerSocket.reference] for more information. | |
268 */ | |
269 abstract class RawServerSocketReference { | |
270 /** | |
271 * Create a new [RawServerSocket], from this reference. | |
272 */ | |
273 Future<RawServerSocket> create(); | |
274 } | |
275 | |
276 | |
250 /** | 277 /** |
251 * A [ServerSocket] represents a listening socket, and provides a | 278 * A [ServerSocket] represents a listening socket, and provides a |
252 * stream of [Socket] objects, one for each connection made to the | 279 * stream of [Socket] objects, one for each connection made to the |
253 * listening socket. | 280 * listening socket. |
254 * | 281 * |
255 * See [Socket] for more info. | 282 * See [Socket] for more info. |
256 */ | 283 */ |
257 abstract class ServerSocket implements Stream<Socket> { | 284 abstract class ServerSocket implements Stream<Socket> { |
258 /** | 285 /** |
259 * Returns a future for a [:ServerSocket:]. When the future | 286 * Returns a future for a [:ServerSocket:]. When the future |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 /** | 325 /** |
299 * Returns the address used by this socket. | 326 * Returns the address used by this socket. |
300 */ | 327 */ |
301 InternetAddress get address; | 328 InternetAddress get address; |
302 | 329 |
303 /** | 330 /** |
304 * Closes the socket. The returned future completes when the socket | 331 * Closes the socket. The returned future completes when the socket |
305 * is fully closed and is no longer bound. | 332 * is fully closed and is no longer bound. |
306 */ | 333 */ |
307 Future<ServerSocket> close(); | 334 Future<ServerSocket> close(); |
335 | |
336 /** | |
337 * Get the [ServerSocketReference]. | |
338 * | |
339 * The reference can be used to clone this [ServerSocket] onto multiple | |
340 * isolates. See [ServerSocketReference] for more information. | |
Lasse Reichstein Nielsen
2014/05/06 09:04:20
ServerSocketReference doesn't really have more inf
Anders Johnsen
2014/05/06 12:34:32
Done.
| |
341 * | |
342 * All cloned [ServerSocket]s will receive incoming [Socket]s using a | |
Lasse Reichstein Nielsen
2014/05/06 09:04:20
Will they get sockets before you listen on the Ser
Anders Johnsen
2014/05/06 12:34:32
Yes
| |
343 * round-robin approach. | |
Lasse Reichstein Nielsen
2014/05/06 09:04:20
It's not round-robin unless they have a circular o
Anders Johnsen
2014/05/06 12:34:32
Done.
| |
344 * | |
345 * WARNING: This feature is highly *experimental* and currently only works on | |
Søren Gjesse
2014/05/06 08:47:39
Move WARNING up.
Anders Johnsen
2014/05/06 12:34:32
Done.
| |
346 * Linux. The API is most likely going to change in the near future. | |
Lasse Reichstein Nielsen
2014/05/06 09:04:20
I'd put "*" around "highly" too.
Anders Johnsen
2014/05/06 12:34:32
Done.
| |
347 */ | |
348 RawServerSocketReference get reference; | |
Søren Gjesse
2014/05/06 08:47:39
Return type ServerSockerReference
Anders Johnsen
2014/05/06 12:34:32
Done.
| |
308 } | 349 } |
309 | 350 |
351 | |
352 /** | |
Søren Gjesse
2014/05/06 08:47:39
Add WARNING
Anders Johnsen
2014/05/06 12:34:32
Done.
| |
353 * A [ServerSocketReference]. | |
354 * | |
355 * See [ServerSocket.reference] for more information. | |
356 */ | |
357 abstract class ServerSocketReference { | |
358 /** | |
359 * Create a new [ServerSocket], from this reference. | |
360 */ | |
361 Future<ServerSocket> create(); | |
362 } | |
363 | |
364 | |
310 /** | 365 /** |
311 * The [SocketDirection] is used as a parameter to [Socket.close] and | 366 * The [SocketDirection] is used as a parameter to [Socket.close] and |
312 * [RawSocket.close] to close a socket in the specified direction(s). | 367 * [RawSocket.close] to close a socket in the specified direction(s). |
313 */ | 368 */ |
314 class SocketDirection { | 369 class SocketDirection { |
315 static const SocketDirection RECEIVE = const SocketDirection._(0); | 370 static const SocketDirection RECEIVE = const SocketDirection._(0); |
316 static const SocketDirection SEND = const SocketDirection._(1); | 371 static const SocketDirection SEND = const SocketDirection._(1); |
317 static const SocketDirection BOTH = const SocketDirection._(2); | 372 static const SocketDirection BOTH = const SocketDirection._(2); |
318 final _value; | 373 final _value; |
319 | 374 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 } | 734 } |
680 if (address != null) { | 735 if (address != null) { |
681 sb.write(", address = ${address.host}"); | 736 sb.write(", address = ${address.host}"); |
682 } | 737 } |
683 if (port != null) { | 738 if (port != null) { |
684 sb.write(", port = $port"); | 739 sb.write(", port = $port"); |
685 } | 740 } |
686 return sb.toString(); | 741 return sb.toString(); |
687 } | 742 } |
688 } | 743 } |
OLD | NEW |