Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: sdk/lib/io/socket.dart

Issue 14766003: Add v6Only named argument to ServerSocket and etc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 7
8 /** 8 /**
9 * [InternetAddressType] is the type an [InternetAddress]. Currently, 9 * [InternetAddressType] is the type an [InternetAddress]. Currently,
10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. 10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 * list. To listen on the loopback adapter, which will allow only 118 * list. To listen on the loopback adapter, which will allow only
119 * incoming connections from the local host, use the value 119 * incoming connections from the local host, use the value
120 * [InternetAddress.LOOPBACK_IP_V4] or 120 * [InternetAddress.LOOPBACK_IP_V4] or
121 * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming 121 * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
122 * connection from the network use either one of the values 122 * connection from the network use either one of the values
123 * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to 123 * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
124 * bind to all interfaces or the IP address of a specific interface. 124 * bind to all interfaces or the IP address of a specific interface.
125 * 125 *
126 * If an IP version 6 (IPv6) address is used, both IP version 6 126 * If an IP version 6 (IPv6) address is used, both IP version 6
127 * (IPv6) and version 4 (IPv4) connections will be accepted. To 127 * (IPv6) and version 4 (IPv4) connections will be accepted. To
128 * restrict this to version 6 (IPv6) only, use [setOption] to set 128 * restrict this to version 6 (IPv6) only, use [v6Only] to set
129 * version 6 only. 129 * version 6 only.
130 * 130 *
131 * If [port] has the value [:0:] an ephemeral port will 131 * If [port] has the value [:0:] an ephemeral port will
132 * be chosen by the system. The actual port used can be retrieved 132 * be chosen by the system. The actual port used can be retrieved
133 * using the [:port:] getter. 133 * using the [:port:] getter.
134 * 134 *
135 * The optional argument [backlog] can be used to specify the listen 135 * The optional argument [backlog] can be used to specify the listen
136 * backlog for the underlying OS listen setup. If [backlog] has the 136 * backlog for the underlying OS listen setup. If [backlog] has the
137 * value of [:0:] (the default) a reasonable value will be chosen by 137 * value of [:0:] (the default) a reasonable value will be chosen by
138 * the system. 138 * the system.
139 */ 139 */
140 external static Future<RawServerSocket> bind(address, 140 external static Future<RawServerSocket> bind(address,
141 int port, 141 int port,
142 {int backlog: 0}); 142 {int backlog: 0,
143 bool v6Only: false});
143 144
144 /** 145 /**
145 * Returns the port used by this socket. 146 * Returns the port used by this socket.
146 */ 147 */
147 int get port; 148 int get port;
148 149
149 /** 150 /**
150 * Closes the socket. 151 * Closes the socket.
151 */ 152 */
152 void close(); 153 void close();
(...skipping 19 matching lines...) Expand all
172 * list. To listen on the loopback adapter, which will allow only 173 * list. To listen on the loopback adapter, which will allow only
173 * incoming connections from the local host, use the value 174 * incoming connections from the local host, use the value
174 * [InternetAddress.LOOPBACK_IP_V4] or 175 * [InternetAddress.LOOPBACK_IP_V4] or
175 * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming 176 * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
176 * connection from the network use either one of the values 177 * connection from the network use either one of the values
177 * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to 178 * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
178 * bind to all interfaces or the IP address of a specific interface. 179 * bind to all interfaces or the IP address of a specific interface.
179 * 180 *
180 * If an IP version 6 (IPv6) address is used, both IP version 6 181 * If an IP version 6 (IPv6) address is used, both IP version 6
181 * (IPv6) and version 4 (IPv4) connections will be accepted. To 182 * (IPv6) and version 4 (IPv4) connections will be accepted. To
182 * restrict this to version 6 (IPv6) only, use [setOption] to set 183 * restrict this to version 6 (IPv6) only, use [v6Only] to set
183 * version 6 only. 184 * version 6 only.
184 * 185 *
185 * If [port] has the value [:0:] an ephemeral port will be chosen by 186 * If [port] has the value [:0:] an ephemeral port will be chosen by
186 * the system. The actual port used can be retrieved using the 187 * the system. The actual port used can be retrieved using the
187 * [port] getter. 188 * [port] getter.
188 * 189 *
189 * The optional argument [backlog] can be used to specify the listen 190 * The optional argument [backlog] can be used to specify the listen
190 * backlog for the underlying OS listen setup. If [backlog] has the 191 * backlog for the underlying OS listen setup. If [backlog] has the
191 * value of [:0:] (the default) a reasonable value will be chosen by 192 * value of [:0:] (the default) a reasonable value will be chosen by
192 * the system. 193 * the system.
193 */ 194 */
194 external static Future<ServerSocket> bind(address, 195 external static Future<ServerSocket> bind(address,
195 int port, 196 int port,
196 {int backlog: 0}); 197 {int backlog: 0,
198 bool v6Only: false});
197 199
198 /** 200 /**
199 * Returns the port used by this socket. 201 * Returns the port used by this socket.
200 */ 202 */
201 int get port; 203 int get port;
202 204
203 /** 205 /**
204 * Closes the socket. 206 * Closes the socket.
205 */ 207 */
206 void close(); 208 void close();
(...skipping 18 matching lines...) Expand all
225 */ 227 */
226 class SocketOption { 228 class SocketOption {
227 /** 229 /**
228 * Enable or disable no-delay on the socket. If TCP_NODELAY is enabled, the 230 * Enable or disable no-delay on the socket. If TCP_NODELAY is enabled, the
229 * socket will not buffer data internally, but instead write each data chunk 231 * socket will not buffer data internally, but instead write each data chunk
230 * as an invidual TCP packet. 232 * as an invidual TCP packet.
231 * 233 *
232 * TCP_NODELAY is disabled by default. 234 * TCP_NODELAY is disabled by default.
233 */ 235 */
234 static const SocketOption TCP_NODELAY = const SocketOption._(0); 236 static const SocketOption TCP_NODELAY = const SocketOption._(0);
237
235 const SocketOption._(this._value); 238 const SocketOption._(this._value);
236 final _value; 239 final _value;
237 } 240 }
238 241
239 /** 242 /**
240 * Events for the [RawSocket]. 243 * Events for the [RawSocket].
241 */ 244 */
242 class RawSocketEvent { 245 class RawSocketEvent {
243 static const RawSocketEvent READ = const RawSocketEvent._(0); 246 static const RawSocketEvent READ = const RawSocketEvent._(0);
244 static const RawSocketEvent WRITE = const RawSocketEvent._(1); 247 static const RawSocketEvent WRITE = const RawSocketEvent._(1);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 sb.write(" ($osError)"); 421 sb.write(" ($osError)");
419 } 422 }
420 } else if (osError != null) { 423 } else if (osError != null) {
421 sb.write(": $osError"); 424 sb.write(": $osError");
422 } 425 }
423 return sb.toString(); 426 return sb.toString();
424 } 427 }
425 final String message; 428 final String message;
426 final OSError osError; 429 final OSError osError;
427 } 430 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698