blob: 21c335cc17cc8f4bbbe4db272a561794bef018d3 [file] [log] [blame]
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:io';
/// Returns whether this computer supports binding to IPv6 addresses.
final Future<bool> supportsIPv6 = () async {
try {
var socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0);
socket.close();
return true;
} on SocketException catch (_) {
return false;
}
}();
/// Returns whether this computer supports binding to IPv4 addresses.
final Future<bool> supportsIPv4 = () async {
try {
var socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0);
socket.close();
return true;
} on SocketException catch (_) {
return false;
}
}();