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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 'RawSocketEvent:READ_CLOSED'][_value]; | 118 'RawSocketEvent:READ_CLOSED'][_value]; |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 /** | 122 /** |
123 * The [RawSocket] is a low-level interface to a socket, exposing the raw | 123 * The [RawSocket] is a low-level interface to a socket, exposing the raw |
124 * events signaled by the system. It's a [Stream] of [RawSocketEvent]s. | 124 * events signaled by the system. It's a [Stream] of [RawSocketEvent]s. |
125 */ | 125 */ |
126 abstract class RawSocket implements Stream<RawSocketEvent> { | 126 abstract class RawSocket implements Stream<RawSocketEvent> { |
127 /** | 127 /** |
128 * Creats a new socket connection to the host and port and returns a [Future] | 128 * Creates a new socket connection to the host and port and returns a [Future] |
129 * that will complete with either a [RawSocket] once connected or an error | 129 * that will complete with either a [RawSocket] once connected or an error |
130 * if the host-lookup or connection failed. | 130 * if the host-lookup or connection failed. |
131 */ | 131 */ |
132 external static Future<RawSocket> connect(String host, int port); | 132 external static Future<RawSocket> connect(String host, int port); |
133 | 133 |
134 /** | 134 /** |
135 * Returns the number of received and non-read bytes in the socket that | 135 * Returns the number of received and non-read bytes in the socket that |
136 * can be read. | 136 * can be read. |
137 */ | 137 */ |
138 int available(); | 138 int available(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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>>, |
216 IOSink<Socket> { | 216 IOSink<Socket> { |
217 /** | 217 /** |
218 * Creats a new socket connection to the host and port and returns a [Future] | 218 * Creats a new socket connection to the host and port and returns a [Future] |
219 * that will complete with either a [RawSocket] once connected or an error | 219 * that will complete with either a [Socket] once connected or an error |
220 * if the host-lookup or connection failed. | 220 * if the host-lookup or connection failed. |
221 */ | 221 */ |
222 external static Future<Socket> connect(String host, int port); | 222 external static Future<Socket> connect(String host, int port); |
223 | 223 |
224 /** | 224 /** |
225 * Destroy the socket in both directions. Calling [destroy] will make the | 225 * 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 | 226 * send a close event on the stream and will no longer react on data being |
227 * piped to it. | 227 * piped to it. |
228 * | 228 * |
229 * Call [close](inherited from [IOSink]) to only close the [Socket] | 229 * Call [close](inherited from [IOSink]) to only close the [Socket] |
(...skipping 27 matching lines...) Expand all Loading... |
257 sb.write(" ($osError)"); | 257 sb.write(" ($osError)"); |
258 } | 258 } |
259 } else if (osError != null) { | 259 } else if (osError != null) { |
260 sb.write(": $osError"); | 260 sb.write(": $osError"); |
261 } | 261 } |
262 return sb.toString(); | 262 return sb.toString(); |
263 } | 263 } |
264 final String message; | 264 final String message; |
265 final OSError osError; | 265 final OSError osError; |
266 } | 266 } |
OLD | NEW |