| 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 * Accepts a connection to this socket. |
| 14 */ | 14 */ |
| 15 Socket accept(); | 15 Socket accept(); |
| 16 | 16 |
| 17 /* | 17 /* |
| 18 * The connection handler gets executed when there are incoming connections | 18 * The connection handler gets executed when there are incoming connections |
| 19 * on the socket. | 19 * on the socket. |
| 20 */ | 20 */ |
| 21 void setConnectionHandler(void callback()); | 21 void set connectionHandler(void callback()); |
| 22 | 22 |
| 23 /* | 23 /* |
| 24 * The error handler gets executed when a socket error occurs. | 24 * The error handler gets executed when a socket error occurs. |
| 25 */ | 25 */ |
| 26 void setErrorHandler(void callback()); | 26 void set errorHandler(void callback()); |
| 27 | 27 |
| 28 /* | 28 /* |
| 29 * Returns the port used by this socket. | 29 * Returns the port used by this socket. |
| 30 */ | 30 */ |
| 31 int get port(); | 31 int get port(); |
| 32 | 32 |
| 33 /* | 33 /* |
| 34 * Closes the socket. | 34 * Closes the socket. |
| 35 */ | 35 */ |
| 36 void close(); | 36 void close(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 64 * function is non-blocking and will only write data if buffer space is | 64 * function is non-blocking and will only write data if buffer space is |
| 65 * available in the socket. It will return 0 if an error occurs, e.g., no | 65 * available in the socket. It will return 0 if an error occurs, e.g., no |
| 66 * buffer space available. | 66 * buffer space available. |
| 67 */ | 67 */ |
| 68 int writeList(List<int> buffer, int offset, int count); | 68 int writeList(List<int> buffer, int offset, int count); |
| 69 | 69 |
| 70 /* | 70 /* |
| 71 * The connect handler gets executed when connection to a given host | 71 * The connect handler gets executed when connection to a given host |
| 72 * succeeded. | 72 * succeeded. |
| 73 */ | 73 */ |
| 74 void setConnectHandler(void callback()); | 74 void set connectHandler(void callback()); |
| 75 | 75 |
| 76 /* | 76 /* |
| 77 * The data handler gets executed when data becomes available at the socket. | 77 * The data handler gets executed when data becomes available at the socket. |
| 78 */ | 78 */ |
| 79 void setDataHandler(void callback()); | 79 void set dataHandler(void callback()); |
| 80 | 80 |
| 81 /* | 81 /* |
| 82 * The write handler gets executed when the socket becomes available for | 82 * The write handler gets executed when the socket becomes available for |
| 83 * writing. | 83 * writing. |
| 84 */ | 84 */ |
| 85 void setWriteHandler(void callback()); | 85 void set writeHandler(void callback()); |
| 86 | 86 |
| 87 /* | 87 /* |
| 88 * The error handler gets executed when a socket error occurs. | 88 * The error handler gets executed when a socket error occurs. |
| 89 */ | 89 */ |
| 90 void setErrorHandler(void callback()); | 90 void set errorHandler(void callback()); |
| 91 | 91 |
| 92 /* | 92 /* |
| 93 * The close handler gets executed when the socket was closed. | 93 * The close handler gets executed when the socket was closed. |
| 94 */ | 94 */ |
| 95 void setCloseHandler(void callback()); | 95 void set closeHandler(void callback()); |
| 96 | 96 |
| 97 /* | 97 /* |
| 98 * Returns input stream to the socket. | 98 * Returns input stream to the socket. |
| 99 */ | 99 */ |
| 100 InputStream get inputStream(); | 100 InputStream get inputStream(); |
| 101 | 101 |
| 102 /* | 102 /* |
| 103 * Returns output stream of the socket. | 103 * Returns output stream of the socket. |
| 104 */ | 104 */ |
| 105 OutputStream get outputStream(); | 105 OutputStream get outputStream(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 119 | 119 |
| 120 class SocketIOException implements Exception { | 120 class SocketIOException implements Exception { |
| 121 const SocketIOException([String this.message = ""]); | 121 const SocketIOException([String this.message = ""]); |
| 122 String toString() => "SocketIOException: $message"; | 122 String toString() => "SocketIOException: $message"; |
| 123 | 123 |
| 124 /* | 124 /* |
| 125 * Contains the exception message. | 125 * Contains the exception message. |
| 126 */ | 126 */ |
| 127 final String message; | 127 final String message; |
| 128 } | 128 } |
| OLD | NEW |