OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 * The [SecureServerSocket] is a server socket, providing a stream of high-level | 8 * The [SecureServerSocket] is a server socket, providing a stream of high-level |
9 * [Socket]s. | 9 * [Socket]s. |
10 * | 10 * |
11 * See [SecureSocket] for more info. | 11 * See [SecureSocket] for more info. |
12 */ | 12 */ |
13 class SecureServerSocket extends Stream<SecureSocket> implements ServerSocket { | 13 class SecureServerSocket extends Stream<SecureSocket> { |
14 final RawSecureServerSocket _socket; | 14 final RawSecureServerSocket _socket; |
15 | 15 |
16 SecureServerSocket._(RawSecureServerSocket this._socket); | 16 SecureServerSocket._(RawSecureServerSocket this._socket); |
17 | 17 |
18 /** | 18 /** |
19 * Returns a future for a [SecureServerSocket]. When the future | 19 * Returns a future for a [SecureServerSocket]. When the future |
20 * completes the server socket is bound to the given [address] and | 20 * completes the server socket is bound to the given [address] and |
21 * [port] and has started listening on it. | 21 * [port] and has started listening on it. |
22 * | 22 * |
23 * The [address] can either be a [String] or an | 23 * The [address] can either be a [String] or an |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 onDone: onDone, | 88 onDone: onDone, |
89 cancelOnError: cancelOnError); | 89 cancelOnError: cancelOnError); |
90 } | 90 } |
91 | 91 |
92 /** | 92 /** |
93 * Returns the port used by this socket. | 93 * Returns the port used by this socket. |
94 */ | 94 */ |
95 int get port => _socket.port; | 95 int get port => _socket.port; |
96 | 96 |
97 /** | 97 /** |
| 98 * Returns the address used by this socket. |
| 99 */ |
| 100 InternetAddress get address => _socket.address; |
| 101 |
| 102 /** |
98 * Closes the socket. The returned future completes when the socket | 103 * Closes the socket. The returned future completes when the socket |
99 * is fully closed and is no longer bound. | 104 * is fully closed and is no longer bound. |
100 */ | 105 */ |
101 Future<SecureServerSocket> close() => _socket.close().then((_) => this); | 106 Future<SecureServerSocket> close() => _socket.close().then((_) => this); |
102 } | 107 } |
103 | 108 |
104 | 109 |
105 /** | 110 /** |
106 * The RawSecureServerSocket is a server socket, providing a stream of low-level | 111 * The RawSecureServerSocket is a server socket, providing a stream of low-level |
107 * [RawSecureSocket]s. | 112 * [RawSecureSocket]s. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 _subscription = _socket.listen(_onData, | 269 _subscription = _socket.listen(_onData, |
265 onDone: _onDone, | 270 onDone: _onDone, |
266 onError: _onError); | 271 onError: _onError); |
267 } else { | 272 } else { |
268 close(); | 273 close(); |
269 } | 274 } |
270 } | 275 } |
271 } | 276 } |
272 | 277 |
273 | 278 |
OLD | NEW |