| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 factory _ServerSocket { | 5 interface ServerSocket factory _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 * Accepts a connection to this socket. | 13 * The connection handler gets called when there is a new incoming |
| 14 * connection on the socket. |
| 14 */ | 15 */ |
| 15 Socket accept(); | 16 void set connectionHandler(void callback(Socket connection)); |
| 16 | 17 |
| 17 /* | 18 /* |
| 18 * The connection handler gets executed when there are incoming connections | 19 * The error handler gets called when a socket error occurs. |
| 19 * on the socket. | |
| 20 */ | |
| 21 void set connectionHandler(void callback()); | |
| 22 | |
| 23 /* | |
| 24 * The error handler gets executed when a socket error occurs. | |
| 25 */ | 20 */ |
| 26 void set errorHandler(void callback()); | 21 void set errorHandler(void callback()); |
| 27 | 22 |
| 28 /* | 23 /* |
| 29 * Returns the port used by this socket. | 24 * Returns the port used by this socket. |
| 30 */ | 25 */ |
| 31 int get port(); | 26 int get port(); |
| 32 | 27 |
| 33 /* | 28 /* |
| 34 * Closes the socket. | 29 * Closes the socket. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 118 |
| 124 class SocketIOException implements Exception { | 119 class SocketIOException implements Exception { |
| 125 const SocketIOException([String this.message = ""]); | 120 const SocketIOException([String this.message = ""]); |
| 126 String toString() => "SocketIOException: $message"; | 121 String toString() => "SocketIOException: $message"; |
| 127 | 122 |
| 128 /* | 123 /* |
| 129 * Contains the exception message. | 124 * Contains the exception message. |
| 130 */ | 125 */ |
| 131 final String message; | 126 final String message; |
| 132 } | 127 } |
| OLD | NEW |