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 factory ServerSocket(String bindAddress, int port, int backlog) { | 10 factory ServerSocket(String bindAddress, int port, int backlog) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 String get remoteHost; | 121 String get remoteHost; |
122 | 122 |
123 /** | 123 /** |
124 * Closes the socket. Calling [close] will never throw an exception | 124 * Closes the socket. Calling [close] will never throw an exception |
125 * and calling it several times is supported. If [halfClose] is true | 125 * and calling it several times is supported. If [halfClose] is true |
126 * the socket will only be closed for writing and it might still be | 126 * the socket will only be closed for writing and it might still be |
127 * possible to read data. Calling [close] will not trigger a call to | 127 * possible to read data. Calling [close] will not trigger a call to |
128 * [onClosed]. | 128 * [onClosed]. |
129 */ | 129 */ |
130 void close([bool halfClose = false]); | 130 void close([bool halfClose = false]); |
131 | |
132 /** | |
133 * Socket is hashable. | |
134 */ | |
135 int hashCode(); | |
136 } | 131 } |
137 | 132 |
138 | 133 |
139 class SocketIOException implements Exception { | 134 class SocketIOException implements Exception { |
140 const SocketIOException([String this.message = "", | 135 const SocketIOException([String this.message = "", |
141 OSError this.osError = null]); | 136 OSError this.osError = null]); |
142 String toString() { | 137 String toString() { |
143 StringBuffer sb = new StringBuffer(); | 138 StringBuffer sb = new StringBuffer(); |
144 sb.add("SocketIOException"); | 139 sb.add("SocketIOException"); |
145 if (!message.isEmpty()) { | 140 if (!message.isEmpty()) { |
146 sb.add(": $message"); | 141 sb.add(": $message"); |
147 if (osError != null) { | 142 if (osError != null) { |
148 sb.add(" ($osError)"); | 143 sb.add(" ($osError)"); |
149 } | 144 } |
150 } else if (osError != null) { | 145 } else if (osError != null) { |
151 sb.add(": $osError"); | 146 sb.add(": $osError"); |
152 } | 147 } |
153 return sb.toString(); | 148 return sb.toString(); |
154 } | 149 } |
155 final String message; | 150 final String message; |
156 final OSError osError; | 151 final OSError osError; |
157 } | 152 } |
OLD | NEW |