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 * The RawServerSocket is a server socket, providing a stream of low-level | 8 * The RawServerSocket is a server socket, providing a stream of low-level |
9 * [RawSocket]s. | 9 * [RawSocket]s. |
10 * | 10 * |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 * Returns the port used by this socket. | 158 * Returns the port used by this socket. |
159 */ | 159 */ |
160 int get port; | 160 int get port; |
161 | 161 |
162 /** | 162 /** |
163 * Returns the remote port connected to by this socket. | 163 * Returns the remote port connected to by this socket. |
164 */ | 164 */ |
165 int get remotePort; | 165 int get remotePort; |
166 | 166 |
167 /** | 167 /** |
| 168 * Returns the host used to connect this socket. |
| 169 */ |
| 170 String get host; |
| 171 |
| 172 /** |
168 * Returns the remote host connected to by this socket. | 173 * Returns the remote host connected to by this socket. |
169 */ | 174 */ |
170 String get remoteHost; | 175 String get remoteHost; |
171 | 176 |
172 /** | 177 /** |
173 * Closes the socket. Calling [close] will never throw an exception | 178 * Closes the socket. Calling [close] will never throw an exception |
174 * and calling it several times is supported. Calling [close] can result in | 179 * and calling it several times is supported. Calling [close] can result in |
175 * a [RawSocketEvent.READ_CLOSED] event. | 180 * a [RawSocketEvent.READ_CLOSED] event. |
176 */ | 181 */ |
177 void close(); | 182 void close(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 void destroy(); | 237 void destroy(); |
233 | 238 |
234 /** | 239 /** |
235 * Use [setOption] to customize the [RawSocket]. See [SocketOption] for | 240 * Use [setOption] to customize the [RawSocket]. See [SocketOption] for |
236 * available options. | 241 * available options. |
237 * | 242 * |
238 * Returns [true] if the option was set successfully, false otherwise. | 243 * Returns [true] if the option was set successfully, false otherwise. |
239 */ | 244 */ |
240 bool setOption(SocketOption option, bool enabled); | 245 bool setOption(SocketOption option, bool enabled); |
241 | 246 |
| 247 /** |
| 248 * Returns the port used by this socket. |
| 249 */ |
242 int get port; | 250 int get port; |
| 251 |
| 252 /** |
| 253 * Returns the remote port connected to by this socket. |
| 254 */ |
| 255 int get remotePort; |
| 256 |
| 257 /** |
| 258 * Returns the host used to connect this socket. |
| 259 */ |
| 260 String get host; |
| 261 |
| 262 /** |
| 263 * Returns the remote host connected to by this socket. |
| 264 */ |
243 String get remoteHost; | 265 String get remoteHost; |
244 int get remotePort; | |
245 } | 266 } |
246 | 267 |
247 | 268 |
248 class SocketIOException implements Exception { | 269 class SocketIOException implements Exception { |
249 const SocketIOException([String this.message = "", | 270 const SocketIOException([String this.message = "", |
250 OSError this.osError = null]); | 271 OSError this.osError = null]); |
251 String toString() { | 272 String toString() { |
252 StringBuffer sb = new StringBuffer(); | 273 StringBuffer sb = new StringBuffer(); |
253 sb.write("SocketIOException"); | 274 sb.write("SocketIOException"); |
254 if (!message.isEmpty) { | 275 if (!message.isEmpty) { |
255 sb.write(": $message"); | 276 sb.write(": $message"); |
256 if (osError != null) { | 277 if (osError != null) { |
257 sb.write(" ($osError)"); | 278 sb.write(" ($osError)"); |
258 } | 279 } |
259 } else if (osError != null) { | 280 } else if (osError != null) { |
260 sb.write(": $osError"); | 281 sb.write(": $osError"); |
261 } | 282 } |
262 return sb.toString(); | 283 return sb.toString(); |
263 } | 284 } |
264 final String message; | 285 final String message; |
265 final OSError osError; | 286 final OSError osError; |
266 } | 287 } |
OLD | NEW |