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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 * version 6 only. | 216 * version 6 only. |
217 * | 217 * |
218 * If [port] has the value [:0:] an ephemeral port will | 218 * If [port] has the value [:0:] an ephemeral port will |
219 * be chosen by the system. The actual port used can be retrieved | 219 * be chosen by the system. The actual port used can be retrieved |
220 * using the [:port:] getter. | 220 * using the [:port:] getter. |
221 * | 221 * |
222 * The optional argument [backlog] can be used to specify the listen | 222 * The optional argument [backlog] can be used to specify the listen |
223 * backlog for the underlying OS listen setup. If [backlog] has the | 223 * backlog for the underlying OS listen setup. If [backlog] has the |
224 * value of [:0:] (the default) a reasonable value will be chosen by | 224 * value of [:0:] (the default) a reasonable value will be chosen by |
225 * the system. | 225 * the system. |
226 * | |
227 * The optional argument [shared] specify whether additional binds | |
228 * to the same `address`, `port` and `v6Only` combination is | |
229 * possible from the same Dart process. If `shared` is `true` and | |
230 * additional binds are preformed, then the incoming (accepted) | |
kustermann
2015/02/17 11:30:56
preformed -> performed
Søren Gjesse
2015/02/17 12:53:11
Done.
| |
231 * connections will be distributed between that set | |
232 * `RawServerSocket`s. One way of using this is to have number of | |
233 * isolates between which incoming connections are distributed. | |
226 */ | 234 */ |
227 external static Future<RawServerSocket> bind(address, | 235 external static Future<RawServerSocket> bind(address, |
228 int port, | 236 int port, |
229 {int backlog: 0, | 237 {int backlog: 0, |
230 bool v6Only: false, | 238 bool v6Only: false, |
231 bool shared: false}); | 239 bool shared: false}); |
232 | 240 |
233 /** | 241 /** |
234 * Returns the port used by this socket. | 242 * Returns the port used by this socket. |
235 */ | 243 */ |
236 int get port; | 244 int get port; |
237 | 245 |
238 /** | 246 /** |
239 * Returns the address used by this socket. | 247 * Returns the address used by this socket. |
240 */ | 248 */ |
241 InternetAddress get address; | 249 InternetAddress get address; |
242 | 250 |
243 /** | 251 /** |
244 * Closes the socket. The returned future completes when the socket | 252 * Closes the socket. The returned future completes when the socket |
245 * is fully closed and is no longer bound. | 253 * is fully closed and is no longer bound. |
246 */ | 254 */ |
247 Future<RawServerSocket> close(); | 255 Future<RawServerSocket> close(); |
248 | 256 |
249 /** | 257 /** |
250 * Get the [RawServerSocketReference]. | 258 * Get the [RawServerSocketReference]. |
251 * | 259 * |
252 * WARNING: This feature is *highly experimental* and currently only works on | 260 * WARNING: This feature is *highly experimental* and currently only |
253 * Linux. The API is most likely going to change in the near future. | 261 * works on Linux. The API will be removed in Dart 1.10. Use the |
262 * `shared` optional argument on the `bind` method instead. | |
254 * | 263 * |
255 * The returned [RawServerSocketReference] can be used to create other | 264 * The returned [RawServerSocketReference] can be used to create other |
256 * [RawServerSocket]s listening on the same port, | 265 * [RawServerSocket]s listening on the same port, |
257 * using [RawServerSocketReference.create]. | 266 * using [RawServerSocketReference.create]. |
258 * Incoming connections on the port will be distributed fairly between the | 267 * Incoming connections on the port will be distributed fairly between the |
259 * active server sockets. | 268 * active server sockets. |
260 * The [RawServerSocketReference] can be distributed to other isolates through | 269 * The [RawServerSocketReference] can be distributed to other isolates through |
261 * a [RawSendPort]. | 270 * a [RawSendPort]. |
262 */ | 271 */ |
272 | |
273 @Deprecated('This will be removed in Dart 1.10. ' | |
274 'Use the `shared` optional argument on the `bind` method instead.' ) | |
kustermann
2015/02/17 11:30:56
long line.
Søren Gjesse
2015/02/17 12:53:11
Done.
| |
263 RawServerSocketReference get reference; | 275 RawServerSocketReference get reference; |
264 } | 276 } |
265 | 277 |
266 | 278 |
267 /** | 279 /** |
268 * A [RawServerSocketReference]. | 280 * A [RawServerSocketReference]. |
269 * | 281 * |
270 * WARNING: This class is used with [RawServerSocket.reference] which is highly | 282 * WARNING: This class is used with [RawServerSocket.reference] which is highly |
271 * experimental. | 283 * experimental. |
272 */ | 284 */ |
285 @Deprecated('This will be removed in Dart 1.10.') | |
273 abstract class RawServerSocketReference { | 286 abstract class RawServerSocketReference { |
274 /** | 287 /** |
275 * Create a new [RawServerSocket], from this reference. | 288 * Create a new [RawServerSocket], from this reference. |
276 */ | 289 */ |
277 Future<RawServerSocket> create(); | 290 Future<RawServerSocket> create(); |
278 } | 291 } |
279 | 292 |
280 | 293 |
281 /** | 294 /** |
282 * A [ServerSocket] represents a listening socket, and provides a | 295 * A [ServerSocket] represents a listening socket, and provides a |
(...skipping 25 matching lines...) Expand all Loading... | |
308 * version 6 only. | 321 * version 6 only. |
309 * | 322 * |
310 * If [port] has the value [:0:] an ephemeral port will be chosen by | 323 * If [port] has the value [:0:] an ephemeral port will be chosen by |
311 * the system. The actual port used can be retrieved using the | 324 * the system. The actual port used can be retrieved using the |
312 * [port] getter. | 325 * [port] getter. |
313 * | 326 * |
314 * The optional argument [backlog] can be used to specify the listen | 327 * The optional argument [backlog] can be used to specify the listen |
315 * backlog for the underlying OS listen setup. If [backlog] has the | 328 * backlog for the underlying OS listen setup. If [backlog] has the |
316 * value of [:0:] (the default) a reasonable value will be chosen by | 329 * value of [:0:] (the default) a reasonable value will be chosen by |
317 * the system. | 330 * the system. |
331 * | |
332 * The optional argument [shared] specify whether additional binds | |
333 * to the same `address`, `port` and `v6Only` combination is | |
334 * possible from the same Dart process. If `shared` is `true` and | |
335 * additional binds are preformed, then the incoming (incoming) | |
kustermann
2015/02/17 11:30:56
ditto
Søren Gjesse
2015/02/17 12:53:11
Done.
| |
336 * connections will be distributed between that set | |
337 * `ServerSocket`s. One way of using this is to have number of | |
338 * isolates between which incoming connections are distributed. | |
318 */ | 339 */ |
319 external static Future<ServerSocket> bind(address, | 340 external static Future<ServerSocket> bind(address, |
320 int port, | 341 int port, |
321 {int backlog: 0, | 342 {int backlog: 0, |
322 bool v6Only: false, | 343 bool v6Only: false, |
323 bool shared: false}); | 344 bool shared: false}); |
324 | 345 |
325 /** | 346 /** |
326 * Returns the port used by this socket. | 347 * Returns the port used by this socket. |
327 */ | 348 */ |
328 int get port; | 349 int get port; |
329 | 350 |
330 /** | 351 /** |
331 * Returns the address used by this socket. | 352 * Returns the address used by this socket. |
332 */ | 353 */ |
333 InternetAddress get address; | 354 InternetAddress get address; |
334 | 355 |
335 /** | 356 /** |
336 * Closes the socket. The returned future completes when the socket | 357 * Closes the socket. The returned future completes when the socket |
337 * is fully closed and is no longer bound. | 358 * is fully closed and is no longer bound. |
338 */ | 359 */ |
339 Future<ServerSocket> close(); | 360 Future<ServerSocket> close(); |
340 | 361 |
341 /** | 362 /** |
342 * Get the [ServerSocketReference]. | 363 * Get the [ServerSocketReference]. |
343 * | 364 * |
344 * WARNING: This feature is *highly experimental* and currently only works on | 365 * WARNING: This feature is *highly experimental* and currently only |
345 * Linux. The API is most likely going to change in the near future. | 366 * works on Linux. The API will be removed in Dart 1.10. Use the |
367 * `shared` optional argument on the `bind` method instead. | |
346 * | 368 * |
347 * The returned [ServerSocketReference] can be used to create other | 369 * The returned [ServerSocketReference] can be used to create other |
348 * [ServerSocket]s listening on the same port, | 370 * [ServerSocket]s listening on the same port, |
349 * using [ServerSocketReference.create]. | 371 * using [ServerSocketReference.create]. |
350 * Incoming connections on the port will be distributed fairly between the | 372 * Incoming connections on the port will be distributed fairly between the |
351 * active server sockets. | 373 * active server sockets. |
352 * The [ServerSocketReference] can be distributed to other isolates through a | 374 * The [ServerSocketReference] can be distributed to other isolates through a |
353 * [SendPort]. | 375 * [SendPort]. |
354 */ | 376 */ |
377 @Deprecated('This will be removed in Dart 1.10. ' | |
378 'Use the `shared` optional argument on the `bind` method instead.' ) | |
kustermann
2015/02/17 11:30:56
long line
Søren Gjesse
2015/02/17 12:53:11
Done.
| |
355 ServerSocketReference get reference; | 379 ServerSocketReference get reference; |
356 } | 380 } |
357 | 381 |
358 | 382 |
359 /** | 383 /** |
360 * A [ServerSocketReference]. | 384 * A [ServerSocketReference]. |
361 * | 385 * |
362 * WARNING: This class is used with [ServerSocket.reference] which is highly | 386 * WARNING: This class is used with [ServerSocket.reference] which is highly |
363 * experimental. | 387 * experimental. |
364 */ | 388 */ |
389 @Deprecated('This will be removed in Dart 1.10.') | |
365 abstract class ServerSocketReference { | 390 abstract class ServerSocketReference { |
366 /** | 391 /** |
367 * Create a new [ServerSocket], from this reference. | 392 * Create a new [ServerSocket], from this reference. |
368 */ | 393 */ |
369 Future<ServerSocket> create(); | 394 Future<ServerSocket> create(); |
370 } | 395 } |
371 | 396 |
372 | 397 |
373 /** | 398 /** |
374 * The [SocketDirection] is used as a parameter to [Socket.close] and | 399 * The [SocketDirection] is used as a parameter to [Socket.close] and |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
752 } | 777 } |
753 if (address != null) { | 778 if (address != null) { |
754 sb.write(", address = ${address.host}"); | 779 sb.write(", address = ${address.host}"); |
755 } | 780 } |
756 if (port != null) { | 781 if (port != null) { |
757 sb.write(", port = $port"); | 782 sb.write(", port = $port"); |
758 } | 783 } |
759 return sb.toString(); | 784 return sb.toString(); |
760 } | 785 } |
761 } | 786 } |
OLD | NEW |