| 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 interface ServerSocket default _ServerSocket { | 5 interface ServerSocket default _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 ServerSocket(String bindAddress, int port, int backlog); | 10 ServerSocket(String bindAddress, int port, int backlog); |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * The connection handler gets called when there is a new incoming | 13 * The connection handler gets called when there is a new incoming |
| 14 * connection on the socket. | 14 * connection on the socket. |
| 15 */ | 15 */ |
| 16 void set onConnection(void callback(Socket connection)); | 16 void set onConnection(void callback(Socket connection)); |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * The error handler gets called when a socket error occurs. | 19 * The error handler gets called when a socket error occurs. |
| 20 */ | 20 */ |
| 21 void set onError(void callback(e)); | 21 void set onError(void callback(e)); |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Returns the port used by this socket. | 24 * Returns the port used by this socket. |
| 25 */ | 25 */ |
| 26 int get port(); | 26 int get port; |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Closes the socket. | 29 * Closes the socket. |
| 30 */ | 30 */ |
| 31 void close(); | 31 void close(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 interface Socket extends Hashable default _Socket { | 35 interface Socket extends Hashable default _Socket { |
| 36 /** | 36 /** |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void set onClosed(void callback()); | 89 void set onClosed(void callback()); |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * The error handler gets called when a socket error occurs. | 92 * The error handler gets called when a socket error occurs. |
| 93 */ | 93 */ |
| 94 void set onError(void callback(e)); | 94 void set onError(void callback(e)); |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * Returns input stream to the socket. | 97 * Returns input stream to the socket. |
| 98 */ | 98 */ |
| 99 InputStream get inputStream(); | 99 InputStream get inputStream; |
| 100 | 100 |
| 101 /** | 101 /** |
| 102 * Returns output stream of the socket. | 102 * Returns output stream of the socket. |
| 103 */ | 103 */ |
| 104 OutputStream get outputStream(); | 104 OutputStream get outputStream; |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * Returns the port used by this socket. | 107 * Returns the port used by this socket. |
| 108 */ | 108 */ |
| 109 int get port(); | 109 int get port; |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * Returns the remote port connected to by this socket. | 112 * Returns the remote port connected to by this socket. |
| 113 */ | 113 */ |
| 114 int get remotePort(); | 114 int get remotePort; |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * Returns the remote host connected to by this socket. | 117 * Returns the remote host connected to by this socket. |
| 118 */ | 118 */ |
| 119 String get remoteHost(); | 119 String get remoteHost; |
| 120 | 120 |
| 121 /** | 121 /** |
| 122 * Closes the socket. Calling [close] will never throw an exception | 122 * Closes the socket. Calling [close] will never throw an exception |
| 123 * and calling it several times is supported. If [halfClose] is true | 123 * and calling it several times is supported. If [halfClose] is true |
| 124 * the socket will only be closed for writing and it might still be | 124 * the socket will only be closed for writing and it might still be |
| 125 * possible to read data. Calling [close] will not trigger a call to | 125 * possible to read data. Calling [close] will not trigger a call to |
| 126 * [onClosed]. | 126 * [onClosed]. |
| 127 */ | 127 */ |
| 128 void close([bool halfClose]); | 128 void close([bool halfClose]); |
| 129 | 129 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 146 sb.add(" ($osError)"); | 146 sb.add(" ($osError)"); |
| 147 } | 147 } |
| 148 } else if (osError != null) { | 148 } else if (osError != null) { |
| 149 sb.add(": $osError"); | 149 sb.add(": $osError"); |
| 150 } | 150 } |
| 151 return sb.toString(); | 151 return sb.toString(); |
| 152 } | 152 } |
| 153 final String message; | 153 final String message; |
| 154 final OSError osError; | 154 final OSError osError; |
| 155 } | 155 } |
| OLD | NEW |