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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 /** | 246 /** |
247 * Returns the address used by this socket. | 247 * Returns the address used by this socket. |
248 */ | 248 */ |
249 InternetAddress get address; | 249 InternetAddress get address; |
250 | 250 |
251 /** | 251 /** |
252 * Closes the socket. The returned future completes when the socket | 252 * Closes the socket. The returned future completes when the socket |
253 * is fully closed and is no longer bound. | 253 * is fully closed and is no longer bound. |
254 */ | 254 */ |
255 Future<RawServerSocket> close(); | 255 Future<RawServerSocket> close(); |
256 | |
257 /** | |
258 * Get the [RawServerSocketReference]. | |
259 * | |
260 * WARNING: This feature is *highly experimental* and currently only | |
261 * works on Linux. The API will be removed in Dart 1.10. Use the | |
262 * `shared` optional argument on the `bind` method instead. | |
263 * | |
264 * The returned [RawServerSocketReference] can be used to create other | |
265 * [RawServerSocket]s listening on the same port, | |
266 * using [RawServerSocketReference.create]. | |
267 * Incoming connections on the port will be distributed fairly between the | |
268 * active server sockets. | |
269 * The [RawServerSocketReference] can be distributed to other isolates through | |
270 * a [RawSendPort]. | |
271 */ | |
272 | |
273 @Deprecated('This will be removed in Dart 1.10. Use the ' | |
274 '`shared` optional argument on the `bind` method instead.') | |
275 RawServerSocketReference get reference; | |
276 } | 256 } |
277 | 257 |
278 | 258 |
279 /** | |
280 * A [RawServerSocketReference]. | |
281 * | |
282 * WARNING: This class is used with [RawServerSocket.reference] which is highly | |
283 * experimental. | |
284 */ | |
285 @Deprecated('This will be removed in Dart 1.10.') | |
286 abstract class RawServerSocketReference { | |
287 /** | |
288 * Create a new [RawServerSocket], from this reference. | |
289 */ | |
290 Future<RawServerSocket> create(); | |
291 } | |
292 | |
293 | |
294 /** | 259 /** |
295 * A [ServerSocket] represents a listening socket, and provides a | 260 * A [ServerSocket] represents a listening socket, and provides a |
296 * stream of [Socket] objects, one for each connection made to the | 261 * stream of [Socket] objects, one for each connection made to the |
297 * listening socket. | 262 * listening socket. |
298 * | 263 * |
299 * See [Socket] for more info. | 264 * See [Socket] for more info. |
300 */ | 265 */ |
301 abstract class ServerSocket implements Stream<Socket> { | 266 abstract class ServerSocket implements Stream<Socket> { |
302 /** | 267 /** |
303 * Returns a future for a [:ServerSocket:]. When the future | 268 * Returns a future for a [:ServerSocket:]. When the future |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 /** | 316 /** |
352 * Returns the address used by this socket. | 317 * Returns the address used by this socket. |
353 */ | 318 */ |
354 InternetAddress get address; | 319 InternetAddress get address; |
355 | 320 |
356 /** | 321 /** |
357 * Closes the socket. The returned future completes when the socket | 322 * Closes the socket. The returned future completes when the socket |
358 * is fully closed and is no longer bound. | 323 * is fully closed and is no longer bound. |
359 */ | 324 */ |
360 Future<ServerSocket> close(); | 325 Future<ServerSocket> close(); |
361 | |
362 /** | |
363 * Get the [ServerSocketReference]. | |
364 * | |
365 * WARNING: This feature is *highly experimental* and currently only | |
366 * works on Linux. The API will be removed in Dart 1.10. Use the | |
367 * `shared` optional argument on the `bind` method instead. | |
368 * | |
369 * The returned [ServerSocketReference] can be used to create other | |
370 * [ServerSocket]s listening on the same port, | |
371 * using [ServerSocketReference.create]. | |
372 * Incoming connections on the port will be distributed fairly between the | |
373 * active server sockets. | |
374 * The [ServerSocketReference] can be distributed to other isolates through a | |
375 * [SendPort]. | |
376 */ | |
377 @Deprecated('This will be removed in Dart 1.10. Use the ' | |
378 '`shared` optional argument on the `bind` method instead.') | |
379 ServerSocketReference get reference; | |
380 } | 326 } |
381 | 327 |
382 | 328 |
383 /** | |
384 * A [ServerSocketReference]. | |
385 * | |
386 * WARNING: This class is used with [ServerSocket.reference] which is highly | |
387 * experimental. | |
388 */ | |
389 @Deprecated('This will be removed in Dart 1.10.') | |
390 abstract class ServerSocketReference { | |
391 /** | |
392 * Create a new [ServerSocket], from this reference. | |
393 */ | |
394 Future<ServerSocket> create(); | |
395 } | |
396 | |
397 | |
398 /** | 329 /** |
399 * The [SocketDirection] is used as a parameter to [Socket.close] and | 330 * The [SocketDirection] is used as a parameter to [Socket.close] and |
400 * [RawSocket.close] to close a socket in the specified direction(s). | 331 * [RawSocket.close] to close a socket in the specified direction(s). |
401 */ | 332 */ |
402 class SocketDirection { | 333 class SocketDirection { |
403 static const SocketDirection RECEIVE = const SocketDirection._(0); | 334 static const SocketDirection RECEIVE = const SocketDirection._(0); |
404 static const SocketDirection SEND = const SocketDirection._(1); | 335 static const SocketDirection SEND = const SocketDirection._(1); |
405 static const SocketDirection BOTH = const SocketDirection._(2); | 336 static const SocketDirection BOTH = const SocketDirection._(2); |
406 final _value; | 337 final _value; |
407 | 338 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 } | 713 } |
783 if (address != null) { | 714 if (address != null) { |
784 sb.write(", address = ${address.host}"); | 715 sb.write(", address = ${address.host}"); |
785 } | 716 } |
786 if (port != null) { | 717 if (port != null) { |
787 sb.write(", port = $port"); | 718 sb.write(", port = $port"); |
788 } | 719 } |
789 return sb.toString(); | 720 return sb.toString(); |
790 } | 721 } |
791 } | 722 } |
OLD | NEW |