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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 * Returns [true] if the option was set successfully, false otherwise. | 205 * Returns [true] if the option was set successfully, false otherwise. |
206 */ | 206 */ |
207 bool setOption(SocketOption option, bool enabled); | 207 bool setOption(SocketOption option, bool enabled); |
208 } | 208 } |
209 | 209 |
210 /** | 210 /** |
211 * A high-level class for communicating over a TCP socket. The [Socket] exposes | 211 * A high-level class for communicating over a TCP socket. The [Socket] exposes |
212 * both a [Stream] and a [IOSink] interface, making it ideal for | 212 * both a [Stream] and a [IOSink] interface, making it ideal for |
213 * using together with other [Stream]s. | 213 * using together with other [Stream]s. |
214 */ | 214 */ |
215 abstract class Socket implements Stream<List<int>>, | 215 abstract class Socket implements Stream<List<int>>, IOSink { |
216 IOSink<Socket> { | |
217 /** | 216 /** |
218 * Creats a new socket connection to the host and port and returns a [Future] | 217 * Creats a new socket connection to the host and port and returns a [Future] |
219 * that will complete with either a [Socket] once connected or an error | 218 * that will complete with either a [Socket] once connected or an error |
220 * if the host-lookup or connection failed. | 219 * if the host-lookup or connection failed. |
221 */ | 220 */ |
222 external static Future<Socket> connect(String host, int port); | 221 external static Future<Socket> connect(String host, int port); |
223 | 222 |
224 /** | 223 /** |
225 * Destroy the socket in both directions. Calling [destroy] will make the | 224 * Destroy the socket in both directions. Calling [destroy] will make the |
226 * send a close event on the stream and will no longer react on data being | 225 * send a close event on the stream and will no longer react on data being |
(...skipping 30 matching lines...) Expand all Loading... |
257 sb.write(" ($osError)"); | 256 sb.write(" ($osError)"); |
258 } | 257 } |
259 } else if (osError != null) { | 258 } else if (osError != null) { |
260 sb.write(": $osError"); | 259 sb.write(": $osError"); |
261 } | 260 } |
262 return sb.toString(); | 261 return sb.toString(); |
263 } | 262 } |
264 final String message; | 263 final String message; |
265 final OSError osError; | 264 final OSError osError; |
266 } | 265 } |
OLD | NEW |