| 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 abstract class ServerSocket { | 5 abstract class ServerSocket { |
| 6 /** | 6 /** |
| 7 * Constructs a new server socket, binds it to a given address and port, | 7 * Constructs a new server socket, binds it to a given address and port, |
| 8 * and listens on it. | 8 * and listens on it. |
| 9 */ | 9 */ |
| 10 external factory ServerSocket(String bindAddress, int port, int backlog); | 10 external factory ServerSocket(String bindAddress, int port, int backlog); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 */ | 40 */ |
| 41 external factory Socket(String host, int port); | 41 external factory Socket(String host, int port); |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Returns the number of received and non-read bytes in the socket that | 44 * Returns the number of received and non-read bytes in the socket that |
| 45 * can be read. | 45 * can be read. |
| 46 */ | 46 */ |
| 47 int available(); | 47 int available(); |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Read up to [len] bytes from the socket. This function is |
| 51 * non-blocking and will only return data if data is available. The |
| 52 * number of bytes read can be less then [len] if fewer bytes are |
| 53 * available for immediate reading. If no data is available [null] |
| 54 * is returned. |
| 55 */ |
| 56 List<int> read([int len]); |
| 57 |
| 58 /** |
| 50 * Reads up to [count] bytes of data from the socket and stores them into | 59 * Reads up to [count] bytes of data from the socket and stores them into |
| 51 * buffer after buffer offset [offset]. The number of successfully read | 60 * buffer after buffer offset [offset]. The number of successfully read |
| 52 * bytes is returned. This function is non-blocking and will only read data | 61 * bytes is returned. This function is non-blocking and will only read data |
| 53 * if data is available. | 62 * if data is available. |
| 54 */ | 63 */ |
| 55 int readList(List<int> buffer, int offset, int count); | 64 int readList(List<int> buffer, int offset, int count); |
| 56 | 65 |
| 57 /** | 66 /** |
| 58 * Writes up to [count] bytes of the buffer from [offset] buffer offset to | 67 * Writes up to [count] bytes of the buffer from [offset] buffer offset to |
| 59 * the socket. The number of successfully written bytes is returned. This | 68 * the socket. The number of successfully written bytes is returned. This |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 sb.add(" ($osError)"); | 150 sb.add(" ($osError)"); |
| 142 } | 151 } |
| 143 } else if (osError != null) { | 152 } else if (osError != null) { |
| 144 sb.add(": $osError"); | 153 sb.add(": $osError"); |
| 145 } | 154 } |
| 146 return sb.toString(); | 155 return sb.toString(); |
| 147 } | 156 } |
| 148 final String message; | 157 final String message; |
| 149 final OSError osError; | 158 final OSError osError; |
| 150 } | 159 } |
| OLD | NEW |