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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 * that will complete with either a [RawSocket] once connected or an error | 193 * that will complete with either a [RawSocket] once connected or an error |
194 * if the host-lookup or connection failed. | 194 * if the host-lookup or connection failed. |
195 */ | 195 */ |
196 external static Future<Socket> connect(String host, int port); | 196 external static Future<Socket> connect(String host, int port); |
197 | 197 |
198 /** | 198 /** |
199 * Destroy the socket in both directions. Calling [destroy] will make the | 199 * Destroy the socket in both directions. Calling [destroy] will make the |
200 * send a close event on the stream and will no longer react on data being | 200 * send a close event on the stream and will no longer react on data being |
201 * piped to it. | 201 * piped to it. |
202 * | 202 * |
203 * Call [close](inherited by [IOSink]) to only close the [Socket] | 203 * Call [close](inherited from [IOSink]) to only close the [Socket] |
204 * for sending data. | 204 * for sending data. |
205 */ | 205 */ |
206 void destroy(); | 206 void destroy(); |
207 | 207 |
208 int get port; | 208 int get port; |
209 String get remoteHost; | 209 String get remoteHost; |
210 int get remotePort; | 210 int get remotePort; |
211 } | 211 } |
212 | 212 |
213 | 213 |
214 class SocketIOException implements Exception { | 214 class SocketIOException implements Exception { |
215 const SocketIOException([String this.message = "", | 215 const SocketIOException([String this.message = "", |
216 OSError this.osError = null]); | 216 OSError this.osError = null]); |
217 String toString() { | 217 String toString() { |
218 StringBuffer sb = new StringBuffer(); | 218 StringBuffer sb = new StringBuffer(); |
219 sb.add("SocketIOException"); | 219 sb.add("SocketIOException"); |
220 if (!message.isEmpty) { | 220 if (!message.isEmpty) { |
221 sb.add(": $message"); | 221 sb.add(": $message"); |
222 if (osError != null) { | 222 if (osError != null) { |
223 sb.add(" ($osError)"); | 223 sb.add(" ($osError)"); |
224 } | 224 } |
225 } else if (osError != null) { | 225 } else if (osError != null) { |
226 sb.add(": $osError"); | 226 sb.add(": $osError"); |
227 } | 227 } |
228 return sb.toString(); | 228 return sb.toString(); |
229 } | 229 } |
230 final String message; | 230 final String message; |
231 final OSError osError; | 231 final OSError osError; |
232 } | 232 } |
OLD | NEW |