| 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 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 connectionHandler(void callback(Socket connection)); | 16 void set connectionHandler(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 errorHandler(void callback()); | 21 void set errorHandler(void callback()); |
| 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 factory _Socket { | 35 interface Socket default _Socket { |
| 36 /* | 36 /* |
| 37 * Constructs a new socket and connects it to the given host on the given | 37 * Constructs a new socket and connects it to the given host on the given |
| 38 * port. | 38 * port. |
| 39 */ | 39 */ |
| 40 Socket(String host, int port); | 40 Socket(String host, int port); |
| 41 | 41 |
| 42 /* | 42 /* |
| 43 * Returns the number of received and non-read bytes in the socket that | 43 * Returns the number of received and non-read bytes in the socket that |
| 44 * can be read. | 44 * can be read. |
| 45 */ | 45 */ |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 class SocketIOException implements Exception { | 119 class SocketIOException implements Exception { |
| 120 const SocketIOException([String this.message = ""]); | 120 const SocketIOException([String this.message = ""]); |
| 121 String toString() => "SocketIOException: $message"; | 121 String toString() => "SocketIOException: $message"; |
| 122 | 122 |
| 123 /* | 123 /* |
| 124 * Contains the exception message. | 124 * Contains the exception message. |
| 125 */ | 125 */ |
| 126 final String message; | 126 final String message; |
| 127 } | 127 } |
| OLD | NEW |