481 references to AddressFamily
Aspire.Hosting (1)
Dcp\DcpHostService.cs (1)
248
Socket socket = new Socket(
AddressFamily
.Unix, SocketType.Stream, ProtocolType.Unspecified);
dotnet-svcutil-lib (2)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (2)
926
AddressFamily
addressFamily = address.AddressFamily;
943
AddressFamily
addressFamily = address.AddressFamily;
IIS.Common.TestLib (6)
TestConnections.cs (6)
30
: this(port,
AddressFamily
.InterNetwork)
34
public TestConnection(int port,
AddressFamily
addressFamily)
238
public static Socket CreateConnectedLoopbackSocket(int port,
AddressFamily
addressFamily)
240
if (addressFamily !=
AddressFamily
.InterNetwork && addressFamily !=
AddressFamily
.InterNetworkV6)
246
var address = addressFamily ==
AddressFamily
.InterNetworkV6
IIS.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\AspNetCorePortTests.cs (1)
161
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
IIS.LongTests (1)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1443
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
IIS.NewHandler.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1443
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
IIS.NewShim.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1443
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
IISExpress.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\AspNetCorePortTests.cs (1)
161
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1443
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
InMemory.FunctionalTests (9)
src\Servers\Kestrel\shared\test\CertHelper.cs (2)
48
using (Socket listener = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
53
var clientSocket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
src\Servers\Kestrel\shared\test\TestConnection.cs (7)
18
: this(port,
AddressFamily
.InterNetwork)
22
public TestConnection(int port,
AddressFamily
addressFamily)
56
public static Socket CreateConnectedLoopbackSocket(int port) => CreateConnectedLoopbackSocket(port,
AddressFamily
.InterNetwork);
58
public static Socket CreateConnectedLoopbackSocket(int port,
AddressFamily
addressFamily)
60
if (addressFamily !=
AddressFamily
.InterNetwork && addressFamily !=
AddressFamily
.InterNetworkV6)
66
var address = addressFamily ==
AddressFamily
.InterNetworkV6
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Internal\JsonTranscodingServerCallContext.cs (2)
87
case
AddressFamily
.InterNetwork:
89
case
AddressFamily
.InterNetworkV6:
Microsoft.AspNetCore.Http.Extensions.Tests (6)
RequestDelegateFactoryTests.cs (4)
334
new object[] { (Action<HttpContext,
AddressFamily
[]>)Store, new[] { "Unix" },new[] {
AddressFamily
.Unix } },
385
new object[] { (Action<HttpContext,
AddressFamily
>)Store, "Unix",
AddressFamily
.Unix },
RequestDelegateGenerator\RequestDelegateCreationTests.Arrays.cs (1)
141
new object[] { "AddressFamily[]", new[] { "Unix" },new[] {
AddressFamily
.Unix } },
RequestDelegateGenerator\RequestDelegateCreationTests.TryParse.cs (1)
52
new object[] { "AddressFamily", "Unix",
AddressFamily
.Unix },
Microsoft.AspNetCore.HttpOverrides (2)
IPNetwork.cs (2)
105
AddressFamily
.InterNetwork => prefixLength <= 32,
106
AddressFamily
.InterNetworkV6 => prefixLength <= 128,
Microsoft.AspNetCore.Rewrite (1)
PatternSegments\IsIPV6Segment.cs (1)
16
return context.HttpContext.Connection.RemoteIpAddress.AddressFamily ==
AddressFamily
.InterNetworkV6 ? "on" : "off";
Microsoft.AspNetCore.Server.HttpSys (8)
src\Shared\HttpSys\NativeInterop\SocketAddress.cs (8)
20
private SocketAddress(
AddressFamily
family, int size)
29
internal
AddressFamily
Family { get; }
38
if (Family ==
AddressFamily
.InterNetworkV6)
42
else if (Family ==
AddressFamily
.InterNetwork)
69
if (addressFamily == (ushort)
AddressFamily
.InterNetwork)
71
var v4address = new SocketAddress(
AddressFamily
.InterNetwork, IPv4AddressSize);
81
if (addressFamily == (ushort)
AddressFamily
.InterNetworkV6)
83
var v6address = new SocketAddress(
AddressFamily
.InterNetworkV6, IPv6AddressSize);
Microsoft.AspNetCore.Server.IIS (8)
src\Shared\HttpSys\NativeInterop\SocketAddress.cs (8)
20
private SocketAddress(
AddressFamily
family, int size)
29
internal
AddressFamily
Family { get; }
38
if (Family ==
AddressFamily
.InterNetworkV6)
42
else if (Family ==
AddressFamily
.InterNetwork)
69
if (addressFamily == (ushort)
AddressFamily
.InterNetwork)
71
var v4address = new SocketAddress(
AddressFamily
.InterNetwork, IPv4AddressSize);
81
if (addressFamily == (ushort)
AddressFamily
.InterNetworkV6)
83
var v6address = new SocketAddress(
AddressFamily
.InterNetworkV6, IPv6AddressSize);
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Common\TestPortHelper.cs (2)
24
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
37
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
Deployers\NginxDeployer.cs (1)
45
_portSelector = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Microsoft.AspNetCore.Server.Kestrel.Core (2)
Internal\Infrastructure\KestrelMetrics.cs (2)
332
case
AddressFamily
.InterNetwork:
335
case
AddressFamily
.InterNetworkV6:
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (9)
src\Servers\Kestrel\shared\test\CertHelper.cs (2)
48
using (Socket listener = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
53
var clientSocket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
src\Servers\Kestrel\shared\test\TestConnection.cs (7)
18
: this(port,
AddressFamily
.InterNetwork)
22
public TestConnection(int port,
AddressFamily
addressFamily)
56
public static Socket CreateConnectedLoopbackSocket(int port) => CreateConnectedLoopbackSocket(port,
AddressFamily
.InterNetwork);
58
public static Socket CreateConnectedLoopbackSocket(int port,
AddressFamily
addressFamily)
60
if (addressFamily !=
AddressFamily
.InterNetwork && addressFamily !=
AddressFamily
.InterNetworkV6)
66
var address = addressFamily ==
AddressFamily
.InterNetworkV6
Microsoft.AspNetCore.Shared.Tests (8)
src\Shared\HttpSys\NativeInterop\SocketAddress.cs (8)
20
private SocketAddress(
AddressFamily
family, int size)
29
internal
AddressFamily
Family { get; }
38
if (Family ==
AddressFamily
.InterNetworkV6)
42
else if (Family ==
AddressFamily
.InterNetwork)
69
if (addressFamily == (ushort)
AddressFamily
.InterNetwork)
71
var v4address = new SocketAddress(
AddressFamily
.InterNetwork, IPv4AddressSize);
81
if (addressFamily == (ushort)
AddressFamily
.InterNetworkV6)
83
var v6address = new SocketAddress(
AddressFamily
.InterNetworkV6, IPv6AddressSize);
Microsoft.Extensions.Diagnostics.ResourceMonitoring (4)
ResourceMonitoringOptionsCustomValidator.cs (2)
26
|| (ipAddress.AddressFamily !=
AddressFamily
.InterNetwork && ipAddress.AddressFamily !=
AddressFamily
.InterNetworkV6))
Windows\Network\WindowsTcpStateInfo.cs (2)
32
.Where(ip => IPAddress.TryParse(ip, out var ipAddress) && ipAddress.AddressFamily ==
AddressFamily
.InterNetwork)
38
.Where(ip => IPAddress.TryParse(ip, out var ipAddress) && ipAddress.AddressFamily ==
AddressFamily
.InterNetworkV6)
Microsoft.Extensions.Hosting.Systemd (1)
SystemdNotifier.cs (1)
50
using (var socket = new Socket(
AddressFamily
.Unix, SocketType.Dgram, ProtocolType.Unspecified))
Microsoft.Extensions.ServiceDiscovery.Abstractions (1)
Internal\ServiceEndpointImpl.cs (1)
17
IPEndPoint ip when ip.Port == 0 && ip.AddressFamily == System.Net.Sockets.
AddressFamily
.InterNetworkV6 => $"[{ip.Address}]",
netstandard (1)
netstandard.cs (1)
1256
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
AddressFamily
))]
Sockets.BindTests (29)
SocketTransportOptionsTests.cs (1)
106
var fileHandleSocket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
src\Servers\Kestrel\shared\test\TestConnection.cs (7)
18
: this(port,
AddressFamily
.InterNetwork)
22
public TestConnection(int port,
AddressFamily
addressFamily)
56
public static Socket CreateConnectedLoopbackSocket(int port) => CreateConnectedLoopbackSocket(port,
AddressFamily
.InterNetwork);
58
public static Socket CreateConnectedLoopbackSocket(int port,
AddressFamily
addressFamily)
60
if (addressFamily !=
AddressFamily
.InterNetwork && addressFamily !=
AddressFamily
.InterNetworkV6)
66
var address = addressFamily ==
AddressFamily
.InterNetworkV6
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6ScopeIdPresentConditionAttribute.cs (1)
27
.Any(addressInfo => addressInfo.Address.AddressFamily ==
AddressFamily
.InterNetworkV6 && addressInfo.Address.ScopeId != 0);
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6SupportedConditionAttribute.cs (1)
24
using (var socket = new Socket(
AddressFamily
.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (19)
538
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
573
using (var socket = new Socket(
AddressFamily
.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
731
ThrowsWhenBindingLocalhostToAddressInUse(
AddressFamily
.InterNetwork);
738
ThrowsWhenBindingLocalhostToAddressInUse(
AddressFamily
.InterNetworkV6);
926
private void ThrowsWhenBindingLocalhostToAddressInUse(
AddressFamily
addressFamily)
933
var address = addressFamily ==
AddressFamily
.InterNetwork ? IPAddress.Loopback : IPAddress.IPv6Loopback;
934
var
otherAddressFamily = addressFamily ==
AddressFamily
.InterNetwork ?
AddressFamily
.InterNetworkV6 :
AddressFamily
.InterNetwork;
940
using (var socket = new Socket(
AddressFamily
.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
975
var thisAddressString = $"http://{(addressFamily ==
AddressFamily
.InterNetwork ? "127.0.0.1" : "[::1]")}:{port}";
976
var otherAddressString = $"http://{(addressFamily ==
AddressFamily
.InterNetworkV6 ? "127.0.0.1" : "[::1]")}:{port}";
1021
.Where(ip => ip.AddressFamily ==
AddressFamily
.InterNetwork)
1066
.Where(ip => ip.AddressFamily ==
AddressFamily
.InterNetwork)
1076
.Where(ip => ip.AddressFamily ==
AddressFamily
.InterNetworkV6)
1124
.Where(ip => ip.AddressFamily ==
AddressFamily
.InterNetworkV6)
1160
.Where(ip => ip.AddressFamily ==
AddressFamily
.InterNetworkV6)
1195
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
Sockets.FunctionalTests (17)
src\Servers\Kestrel\shared\test\TestConnection.cs (7)
18
: this(port,
AddressFamily
.InterNetwork)
22
public TestConnection(int port,
AddressFamily
addressFamily)
56
public static Socket CreateConnectedLoopbackSocket(int port) => CreateConnectedLoopbackSocket(port,
AddressFamily
.InterNetwork);
58
public static Socket CreateConnectedLoopbackSocket(int port,
AddressFamily
addressFamily)
60
if (addressFamily !=
AddressFamily
.InterNetwork && addressFamily !=
AddressFamily
.InterNetworkV6)
66
var address = addressFamily ==
AddressFamily
.InterNetworkV6
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6ScopeIdPresentConditionAttribute.cs (1)
27
.Any(addressInfo => addressInfo.Address.AddressFamily ==
AddressFamily
.InterNetworkV6 && addressInfo.Address.ScopeId != 0);
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6SupportedConditionAttribute.cs (1)
24
using (var socket = new Socket(
AddressFamily
.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
src\Servers\Kestrel\test\FunctionalTests\ListenHandleTests.cs (1)
29
new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
src\Servers\Kestrel\test\FunctionalTests\MaxRequestBufferSizeTests.cs (1)
378
var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (4)
116
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
568
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
615
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
709
using (var socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
src\Servers\Kestrel\test\FunctionalTests\UnixDomainSocketsTests.cs (2)
97
using (var socket = new Socket(
AddressFamily
.Unix, SocketType.Stream, ProtocolType.Unspecified))
165
using (var socket = new Socket(
AddressFamily
.Unix, SocketType.Stream, ProtocolType.Unspecified))
System (1)
src\libraries\shims\System\ref\System.cs (1)
746
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
AddressFamily
))]
System.IO.Pipes (2)
System\IO\Pipes\NamedPipeClientStream.Unix.cs (1)
38
var socket = new Socket(
AddressFamily
.Unix, SocketType.Stream, ProtocolType.Unspecified);
System\IO\Pipes\NamedPipeServerStream.Unix.cs (1)
326
var socket = new Socket(
AddressFamily
.Unix, SocketType.Stream, ProtocolType.Unspecified);
System.Net (1)
System.Net.cs (1)
37
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
AddressFamily
))]
System.Net.Http (5)
System\Net\Http\SocketsHttpHandler\SocksHelper.cs (5)
158
if (hostIP.AddressFamily ==
AddressFamily
.InterNetwork)
167
Debug.Assert(hostIP.AddressFamily ==
AddressFamily
.InterNetworkV6);
232
if (hostIP.AddressFamily ==
AddressFamily
.InterNetwork)
252
? await Dns.GetHostAddressesAsync(host,
AddressFamily
.InterNetwork, cancellationToken).ConfigureAwait(false)
253
: Dns.GetHostAddresses(host,
AddressFamily
.InterNetwork);
System.Net.NameResolution (65)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.HostEntry.cs (1)
37
internal static unsafe partial int GetHostEntryForName(string address,
AddressFamily
family, HostEntry* entry);
src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (1)
18
if (ipAddress.AddressFamily ==
AddressFamily
.InterNetworkV6)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (5)
60
public static unsafe
AddressFamily
GetAddressFamily(ReadOnlySpan<byte> buffer)
62
AddressFamily
family;
73
public static unsafe void SetAddressFamily(Span<byte> buffer,
AddressFamily
family)
77
if (family !=
AddressFamily
.Unknown)
178
AddressFamily
family = GetAddressFamily(buffer);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.cs (3)
13
public static bool OSSupportsIPv6 { get; } = IsSupported(
AddressFamily
.InterNetworkV6) && !IsIPv6Disabled();
14
public static bool OSSupportsIPv4 { get; } = IsSupported(
AddressFamily
.InterNetwork);
15
public static bool OSSupportsUnixDomainSockets { get; } = IsSupported(
AddressFamily
.Unix);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.Unix.cs (2)
13
private static unsafe bool IsSupported(
AddressFamily
af)
17
if (af ==
AddressFamily
.Unix && (OperatingSystem.IsTvOS() || OperatingSystem.IsWasi() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst())))
System\Net\Dns.cs (48)
51
IPHostEntry ipHostEntry = GetHostEntryCore(address,
AddressFamily
.Unspecified);
58
GetHostEntry(hostNameOrAddress,
AddressFamily
.Unspecified);
64
/// <param name="family">The address family for which IPs should be retrieved. If <see cref="
AddressFamily
.Unspecified"/>, retrieve all IPs regardless of address family.</param>
68
public static IPHostEntry GetHostEntry(string hostNameOrAddress,
AddressFamily
family)
94
GetHostEntryAsync(hostNameOrAddress,
AddressFamily
.Unspecified, CancellationToken.None);
106
GetHostEntryAsync(hostNameOrAddress,
AddressFamily
.Unspecified, cancellationToken);
112
/// <param name="family">The address family for which IPs should be retrieved. If <see cref="
AddressFamily
.Unspecified"/>, retrieve all IPs regardless of address family.</param>
118
public static Task<IPHostEntry> GetHostEntryAsync(string hostNameOrAddress,
AddressFamily
family, CancellationToken cancellationToken = default)
166
IPHostEntry ipHostEntry = GetHostEntryCore((IPAddress)s,
AddressFamily
.Unspecified, activity);
188
=> GetHostAddresses(hostNameOrAddress,
AddressFamily
.Unspecified);
194
/// <param name="family">The address family for which IPs should be retrieved. If <see cref="
AddressFamily
.Unspecified"/>, retrieve all IPs regardless of address family.</param>
198
public static IPAddress[] GetHostAddresses(string hostNameOrAddress,
AddressFamily
family)
212
addresses = (family ==
AddressFamily
.Unspecified || address.AddressFamily == family) ? new IPAddress[] { address } : Array.Empty<IPAddress>();
224
(Task<IPAddress[]>)GetHostEntryOrAddressesCoreAsync(hostNameOrAddress, justReturnParsedIp: true, throwOnIIPAny: true, justAddresses: true,
AddressFamily
.Unspecified, CancellationToken.None);
236
(Task<IPAddress[]>)GetHostEntryOrAddressesCoreAsync(hostNameOrAddress, justReturnParsedIp: true, throwOnIIPAny: true, justAddresses: true,
AddressFamily
.Unspecified, cancellationToken);
242
/// <param name="family">The address family for which IPs should be retrieved. If <see cref="
AddressFamily
.Unspecified"/>, retrieve all IPs regardless of address family.</param>
248
public static Task<IPAddress[]> GetHostAddressesAsync(string hostNameOrAddress,
AddressFamily
family, CancellationToken cancellationToken = default) =>
273
return GetHostEntryCore(hostName,
AddressFamily
.Unspecified);
278
TaskToAsyncResult.Begin(GetHostEntryCoreAsync(hostName, justReturnParsedIp: true, throwOnIIPAny: true,
AddressFamily
.Unspecified, CancellationToken.None), requestCallback, stateObject);
297
IPHostEntry ipHostEntry = GetHostEntryCore(IPAddress.Parse(address),
AddressFamily
.Unspecified);
310
IPHostEntry ipHostEntry = GetHostEntryCore(address,
AddressFamily
.Unspecified);
324
(address.AddressFamily !=
AddressFamily
.InterNetworkV6 || SocketProtocolSupportPal.OSSupportsIPv6))
328
ipHostEntry = GetHostEntryCore(address,
AddressFamily
.Unspecified);
338
ipHostEntry = GetHostEntryCore(hostName,
AddressFamily
.Unspecified);
347
TaskToAsyncResult.Begin(GetHostEntryCoreAsync(hostName, justReturnParsedIp: false, throwOnIIPAny: false,
AddressFamily
.Unspecified, CancellationToken.None), requestCallback, stateObject);
367
KeyValuePair<IPAddress,
AddressFamily
> t => t.Key,
383
private static IPHostEntry GetHostEntryCore(string hostName,
AddressFamily
addressFamily, NameResolutionActivity? activityOrDefault = default) =>
386
private static IPAddress[] GetHostAddressesCore(string hostName,
AddressFamily
addressFamily, NameResolutionActivity? activityOrDefault = default) =>
389
private static object GetHostEntryOrAddressesCore(string hostName, bool justAddresses,
AddressFamily
addressFamily, NameResolutionActivity? activityOrDefault = default)
427
private static IPHostEntry GetHostEntryCore(IPAddress address,
AddressFamily
addressFamily, NameResolutionActivity? activityOrDefault = default) =>
430
private static IPAddress[] GetHostAddressesCore(IPAddress address,
AddressFamily
addressFamily, NameResolutionActivity? activityOrDefault = default) =>
434
private static object GetHostEntryOrAddressesCore(IPAddress address, bool justAddresses,
AddressFamily
addressFamily, NameResolutionActivity? activityOrDefault = default)
506
private static Task<IPHostEntry> GetHostEntryCoreAsync(string hostName, bool justReturnParsedIp, bool throwOnIIPAny,
AddressFamily
family, CancellationToken cancellationToken) =>
510
private static Task GetHostEntryOrAddressesCoreAsync(string hostName, bool justReturnParsedIp, bool throwOnIIPAny, bool justAddresses,
AddressFamily
family, CancellationToken cancellationToken)
535
Task.FromResult(family ==
AddressFamily
.Unspecified || ipAddress.AddressFamily == family ? new[] { ipAddress } : Array.Empty<IPAddress>()) :
539
asyncState = family ==
AddressFamily
.Unspecified ? (object)ipAddress : new KeyValuePair<IPAddress,
AddressFamily
>(ipAddress, family);
573
asyncState = family ==
AddressFamily
.Unspecified ? (object)hostName : new KeyValuePair<string,
AddressFamily
>(hostName, family);
580
string h => GetHostAddressesCore(h,
AddressFamily
.Unspecified, activity),
581
KeyValuePair<string,
AddressFamily
> t => GetHostAddressesCore(t.Key, t.Value, activity),
582
IPAddress a => GetHostAddressesCore(a,
AddressFamily
.Unspecified, activity),
583
KeyValuePair<IPAddress,
AddressFamily
> t => GetHostAddressesCore(t.Key, t.Value, activity),
591
string h => GetHostEntryCore(h,
AddressFamily
.Unspecified, activity),
592
KeyValuePair<string,
AddressFamily
> t => GetHostEntryCore(t.Key, t.Value, activity),
593
IPAddress a => GetHostEntryCore(a,
AddressFamily
.Unspecified, activity),
594
KeyValuePair<IPAddress,
AddressFamily
> t => GetHostEntryCore(t.Key, t.Value, activity),
600
private static Task<T>? GetAddrInfoWithTelemetryAsync<T>(string hostName, bool justAddresses,
AddressFamily
addressFamily, CancellationToken cancellationToken)
System\Net\NameResolutionPal.Unix.cs (3)
23
internal static Task? GetAddrInfoAsync(string hostName, bool justAddresses,
AddressFamily
family, CancellationToken cancellationToken) =>
130
public static unsafe SocketError TryGetAddrInfo(string name, bool justAddresses,
AddressFamily
addressFamily, out string? hostName, out string[] aliases, out IPAddress[] addresses, out int nativeErrorCode)
162
if (addr.AddressFamily ==
AddressFamily
.InterNetwork)
System\Net\NameResolutionTelemetry.cs (2)
133
KeyValuePair<string,
AddressFamily
> t => t.Key,
135
KeyValuePair<IPAddress,
AddressFamily
> t => t.Key.ToString(),
System.Net.NetworkInformation (10)
System\Net\NetworkInformation\IPAddressUtil.cs (1)
17
if (address.AddressFamily ==
AddressFamily
.InterNetworkV6)
System\Net\NetworkInformation\UnicastIPAddressInformation.cs (4)
70
internal static IPAddress PrefixLengthToSubnetMask(byte prefixLength,
AddressFamily
family)
73
Debug.Assert((family ==
AddressFamily
.InterNetwork) || (family ==
AddressFamily
.InterNetworkV6));
75
Span<byte> addressBytes = (family ==
AddressFamily
.InterNetwork) ?
System\Net\NetworkInformation\UnixNetworkInterface.cs (3)
37
Sockets.
AddressFamily
family = (networkInterfaceComponent == NetworkInterfaceComponent.IPv4) ?
38
Sockets.
AddressFamily
.InterNetwork :
39
Sockets.
AddressFamily
.InterNetworkV6;
System\Net\NetworkInformation\UnixUnicastIPAddressInformation.cs (2)
109
if (Address.AddressFamily !=
AddressFamily
.InterNetwork || _prefixLength == 0)
114
return PrefixLengthToSubnetMask((byte)_prefixLength,
AddressFamily
.InterNetwork);
System.Net.Ping (31)
src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (5)
13
AddressFamily
family = SocketAddressPal.GetAddressFamily(socketAddressBuffer);
15
if (family ==
AddressFamily
.InterNetworkV6)
24
else if (family ==
AddressFamily
.InterNetwork)
36
if (address.AddressFamily ==
AddressFamily
.InterNetwork)
70
if (endPoint.AddressFamily ==
AddressFamily
.InterNetwork)
src\libraries\Common\src\System\Net\RawSocketPermissions.cs (6)
10
private static readonly Lazy<bool> s_canUseRawIPv4Sockets = new Lazy<bool>(() => CheckRawSocketPermissions(
AddressFamily
.InterNetwork));
11
private static readonly Lazy<bool> s_canUseRawIPv6Sockets = new Lazy<bool>(() => CheckRawSocketPermissions(
AddressFamily
.InterNetworkV6));
16
public static bool CanUseRawSockets(
AddressFamily
addressFamily) =>
17
addressFamily ==
AddressFamily
.InterNetworkV6 ?
21
private static bool CheckRawSocketPermissions(
AddressFamily
addressFamily)
25
new Socket(addressFamily, SocketType.Raw, addressFamily ==
AddressFamily
.InterNetwork ? ProtocolType.Icmp : ProtocolType.IcmpV6).Dispose();
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (5)
60
public static unsafe
AddressFamily
GetAddressFamily(ReadOnlySpan<byte> buffer)
62
AddressFamily
family;
73
public static unsafe void SetAddressFamily(Span<byte> buffer,
AddressFamily
family)
77
if (family !=
AddressFamily
.Unknown)
178
AddressFamily
family = GetAddressFamily(buffer);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.cs (3)
13
public static bool OSSupportsIPv6 { get; } = IsSupported(
AddressFamily
.InterNetworkV6) && !IsIPv6Disabled();
14
public static bool OSSupportsIPv4 { get; } = IsSupported(
AddressFamily
.InterNetwork);
15
public static bool OSSupportsUnixDomainSockets { get; } = IsSupported(
AddressFamily
.Unix);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.Unix.cs (2)
13
private static unsafe bool IsSupported(
AddressFamily
af)
17
if (af ==
AddressFamily
.Unix && (OperatingSystem.IsTvOS() || OperatingSystem.IsWasi() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst())))
System\Net\NetworkInformation\Ping.cs (3)
108
IPAddress addressSnapshot = address.AddressFamily ==
AddressFamily
.InterNetwork ?
740
if (ip.AddressFamily ==
AddressFamily
.InterNetwork && !SocketProtocolSupportPal.OSSupportsIPv4)
744
else if ((ip.AddressFamily ==
AddressFamily
.InterNetworkV6 && !SocketProtocolSupportPal.OSSupportsIPv6))
System\Net\NetworkInformation\Ping.PingUtility.cs (2)
20
bool isIpv4 = address.AddressFamily ==
AddressFamily
.InterNetwork;
36
if (options != null && address.AddressFamily ==
AddressFamily
.InterNetwork)
System\Net\NetworkInformation\Ping.RawSocket.cs (5)
31
bool ipv4 = address.AddressFamily ==
AddressFamily
.InterNetwork;
64
AddressFamily
addrFamily = ep.Address.AddressFamily;
72
if (addrFamily ==
AddressFamily
.InterNetworkV6 && !SupportsDualMode)
84
if (addrFamily ==
AddressFamily
.InterNetwork)
101
bool ipv4 = addrFamily ==
AddressFamily
.InterNetwork;
System.Net.Primitives (46)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.HostEntry.cs (1)
37
internal static unsafe partial int GetHostEntryForName(string address,
AddressFamily
family, HostEntry* entry);
src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (5)
13
AddressFamily
family = SocketAddressPal.GetAddressFamily(socketAddressBuffer);
15
if (family ==
AddressFamily
.InterNetworkV6)
24
else if (family ==
AddressFamily
.InterNetwork)
36
if (address.AddressFamily ==
AddressFamily
.InterNetwork)
70
if (endPoint.AddressFamily ==
AddressFamily
.InterNetwork)
src\libraries\Common\src\System\Net\SocketAddress.cs (10)
26
public
AddressFamily
Family
72
public static int GetMaximumAddressSize(
AddressFamily
addressFamily) => addressFamily switch
74
AddressFamily
.InterNetwork => IPv4AddressSize,
75
AddressFamily
.InterNetworkV6 => IPv6AddressSize,
76
AddressFamily
.Unix => UdsAddressSize,
80
public SocketAddress(
AddressFamily
family) : this(family, GetMaximumAddressSize(family))
84
public SocketAddress(
AddressFamily
family, int size)
97
((ipAddress.AddressFamily ==
AddressFamily
.InterNetwork) ? IPv4AddressSize : IPv6AddressSize))
103
if (ipAddress.AddressFamily ==
AddressFamily
.InterNetworkV6)
117
Debug.Assert(ipAddress.AddressFamily ==
AddressFamily
.InterNetwork);
src\libraries\Common\src\System\Net\SocketAddressExtensions.cs (2)
14
Debug.Assert(socketAddress.Family ==
AddressFamily
.InterNetwork || socketAddress.Family ==
AddressFamily
.InterNetworkV6);
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (5)
60
public static unsafe
AddressFamily
GetAddressFamily(ReadOnlySpan<byte> buffer)
62
AddressFamily
family;
73
public static unsafe void SetAddressFamily(Span<byte> buffer,
AddressFamily
family)
77
if (family !=
AddressFamily
.Unknown)
178
AddressFamily
family = GetAddressFamily(buffer);
System\Net\DnsEndPoint.cs (7)
13
private readonly
AddressFamily
_family;
15
public DnsEndPoint(string host, int port) : this(host, port,
AddressFamily
.Unspecified) { }
17
public DnsEndPoint(string host, int port,
AddressFamily
addressFamily)
24
if (addressFamily !=
AddressFamily
.InterNetwork &&
25
addressFamily !=
AddressFamily
.InterNetworkV6 &&
26
addressFamily !=
AddressFamily
.Unspecified)
52
public override
AddressFamily
AddressFamily => _family;
System\Net\EndPoint.cs (1)
22
public virtual
AddressFamily
AddressFamily
System\Net\IPAddress.cs (5)
400
public
AddressFamily
AddressFamily
404
return IsIPv4 ?
AddressFamily
.InterNetwork :
AddressFamily
.InterNetworkV6;
642
if (AddressFamily ==
AddressFamily
.InterNetworkV6)
651
if (AddressFamily ==
AddressFamily
.InterNetworkV6)
System\Net\IPEndPoint.cs (5)
28
public override
AddressFamily
AddressFamily => _address.AddressFamily;
148
_address.AddressFamily ==
AddressFamily
.InterNetworkV6 ?
158
if (socketAddress.Family is not (
AddressFamily
.InterNetwork or
AddressFamily
.InterNetworkV6))
163
int minSize = AddressFamily ==
AddressFamily
.InterNetworkV6 ? SocketAddress.IPv6AddressSize : SocketAddress.IPv4AddressSize;
System\Net\IPNetwork.cs (5)
44
/// <exception cref="ArgumentOutOfRangeException">The specified <paramref name="prefixLength"/> is smaller than `0` or longer than maximum length of <paramref name="prefixLength"/>'s <see cref="
AddressFamily
"/>.</exception>
87
if (address.AddressFamily != BaseAddress.AddressFamily && (BaseAddress.AddressFamily !=
AddressFamily
.InterNetwork || !address.IsIPv4MappedToIPv6))
98
if (address.AddressFamily ==
AddressFamily
.InterNetwork || address.IsIPv4MappedToIPv6)
248
private static int GetMaxPrefixLength(IPAddress baseAddress) => baseAddress.AddressFamily ==
AddressFamily
.InterNetwork ? 32 : 128;
252
if (baseAddress.AddressFamily ==
AddressFamily
.InterNetwork)
System.Net.Quic (12)
src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (5)
13
AddressFamily
family = SocketAddressPal.GetAddressFamily(socketAddressBuffer);
15
if (family ==
AddressFamily
.InterNetworkV6)
24
else if (family ==
AddressFamily
.InterNetwork)
36
if (address.AddressFamily ==
AddressFamily
.InterNetwork)
70
if (endPoint.AddressFamily ==
AddressFamily
.InterNetwork)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (5)
60
public static unsafe
AddressFamily
GetAddressFamily(ReadOnlySpan<byte> buffer)
62
AddressFamily
family;
73
public static unsafe void SetAddressFamily(Span<byte> buffer,
AddressFamily
family)
77
if (family !=
AddressFamily
.Unknown)
178
AddressFamily
family = GetAddressFamily(buffer);
System\Net\Quic\Internal\MsQuicHelpers.cs (2)
38
internal static unsafe IPEndPoint QuicAddrToIPEndPoint(QuicAddr* quicAddress,
AddressFamily
? addressFamilyOverride = null)
44
SocketAddressPal.SetAddressFamily(addressBytes, (
AddressFamily
)addressFamilyOverride!);
System.Net.Requests (5)
System\Net\FtpControlStream.cs (5)
599
string passiveCommand = (ServerAddress.AddressFamily ==
AddressFamily
.InterNetwork || ServerAddress.IsIPv4MappedToIPv6) ? "PASV" : "EPSV";
604
string portCommand = (ServerAddress.AddressFamily ==
AddressFamily
.InterNetwork || ServerAddress.IsIPv4MappedToIPv6) ? "PORT" : "EPRT";
1126
if (ServerAddress.AddressFamily ==
AddressFamily
.InterNetwork || ServerAddress.IsIPv4MappedToIPv6)
1130
else if (ServerAddress.AddressFamily ==
AddressFamily
.InterNetworkV6)
1169
if (templateSocket.AddressFamily ==
AddressFamily
.InterNetworkV6 && templateSocket.DualMode)
System.Net.Sockets (175)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetSocketType.cs (1)
12
internal static partial Error GetSocketType(SafeSocketHandle socket, out
AddressFamily
addressFamily, out SocketType socketType, out ProtocolType protocolType, [MarshalAs(UnmanagedType.Bool)] out bool isListening);
src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (1)
18
if (ipAddress.AddressFamily ==
AddressFamily
.InterNetworkV6)
src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (5)
13
AddressFamily
family = SocketAddressPal.GetAddressFamily(socketAddressBuffer);
15
if (family ==
AddressFamily
.InterNetworkV6)
24
else if (family ==
AddressFamily
.InterNetwork)
36
if (address.AddressFamily ==
AddressFamily
.InterNetwork)
70
if (endPoint.AddressFamily ==
AddressFamily
.InterNetwork)
src\libraries\Common\src\System\Net\SocketAddressExtensions.cs (2)
14
Debug.Assert(socketAddress.Family ==
AddressFamily
.InterNetwork || socketAddress.Family ==
AddressFamily
.InterNetworkV6);
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (5)
60
public static unsafe
AddressFamily
GetAddressFamily(ReadOnlySpan<byte> buffer)
62
AddressFamily
family;
73
public static unsafe void SetAddressFamily(Span<byte> buffer,
AddressFamily
family)
77
if (family !=
AddressFamily
.Unknown)
178
AddressFamily
family = GetAddressFamily(buffer);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.cs (3)
13
public static bool OSSupportsIPv6 { get; } = IsSupported(
AddressFamily
.InterNetworkV6) && !IsIPv6Disabled();
14
public static bool OSSupportsIPv4 { get; } = IsSupported(
AddressFamily
.InterNetwork);
15
public static bool OSSupportsUnixDomainSockets { get; } = IsSupported(
AddressFamily
.Unix);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.Unix.cs (2)
13
private static unsafe bool IsSupported(
AddressFamily
af)
17
if (af ==
AddressFamily
.Unix && (OperatingSystem.IsTvOS() || OperatingSystem.IsWasi() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst())))
src\libraries\Common\src\System\Net\Sockets\ProtocolFamily.cs (32)
16
Unknown =
AddressFamily
.Unknown,
17
Unspecified =
AddressFamily
.Unspecified,
18
Unix =
AddressFamily
.Unix,
19
InterNetwork =
AddressFamily
.InterNetwork,
20
ImpLink =
AddressFamily
.ImpLink,
21
Pup =
AddressFamily
.Pup,
22
Chaos =
AddressFamily
.Chaos,
23
NS =
AddressFamily
.NS,
24
Ipx =
AddressFamily
.Ipx,
25
Iso =
AddressFamily
.Iso,
26
Osi =
AddressFamily
.Osi,
27
Ecma =
AddressFamily
.Ecma,
28
DataKit =
AddressFamily
.DataKit,
29
Ccitt =
AddressFamily
.Ccitt,
30
Sna =
AddressFamily
.Sna,
31
DecNet =
AddressFamily
.DecNet,
32
DataLink =
AddressFamily
.DataLink,
33
Lat =
AddressFamily
.Lat,
34
HyperChannel =
AddressFamily
.HyperChannel,
35
AppleTalk =
AddressFamily
.AppleTalk,
36
NetBios =
AddressFamily
.NetBios,
37
VoiceView =
AddressFamily
.VoiceView,
38
FireFox =
AddressFamily
.FireFox,
39
Banyan =
AddressFamily
.Banyan,
40
Atm =
AddressFamily
.Atm,
41
InterNetworkV6 =
AddressFamily
.InterNetworkV6,
42
Cluster =
AddressFamily
.Cluster,
43
Ieee12844 =
AddressFamily
.Ieee12844,
44
Irda =
AddressFamily
.Irda,
45
NetworkDesigners =
AddressFamily
.NetworkDesigners,
47
Packet =
AddressFamily
.Packet,
48
ControllerAreaNetwork =
AddressFamily
.ControllerAreaNetwork,
System\Net\Sockets\Socket.cs (61)
62
private
AddressFamily
_addressFamily;
73
: this(OSSupportsIPv6DualMode ?
AddressFamily
.InterNetworkV6 :
AddressFamily
.InterNetwork, socketType, protocolType)
82
public Socket(
AddressFamily
addressFamily, SocketType socketType, ProtocolType protocolType)
122
_addressFamily =
AddressFamily
.Unknown;
157
case
AddressFamily
.InterNetwork:
163
case
AddressFamily
.InterNetworkV6:
171
case
AddressFamily
.Unix:
191
case
AddressFamily
.InterNetwork:
197
case
AddressFamily
.InterNetworkV6:
205
case
AddressFamily
.Unix:
325
if (_addressFamily ==
AddressFamily
.InterNetwork || _addressFamily ==
AddressFamily
.InterNetworkV6)
371
if (_addressFamily ==
AddressFamily
.InterNetwork || _addressFamily ==
AddressFamily
.InterNetworkV6)
462
public
AddressFamily
AddressFamily
615
if (_addressFamily ==
AddressFamily
.InterNetwork)
619
else if (_addressFamily ==
AddressFamily
.InterNetworkV6)
635
if (_addressFamily ==
AddressFamily
.InterNetwork)
640
else if (_addressFamily ==
AddressFamily
.InterNetworkV6)
657
if (_addressFamily ==
AddressFamily
.InterNetwork || (_addressFamily ==
AddressFamily
.InterNetworkV6 && DualMode))
671
if (_addressFamily ==
AddressFamily
.InterNetwork || (_addressFamily ==
AddressFamily
.InterNetworkV6 && DualMode))
690
if (_addressFamily ==
AddressFamily
.InterNetwork)
694
else if (_addressFamily ==
AddressFamily
.InterNetworkV6)
707
if (_addressFamily ==
AddressFamily
.InterNetwork)
712
else if (_addressFamily ==
AddressFamily
.InterNetworkV6)
748
if (AddressFamily !=
AddressFamily
.InterNetworkV6)
760
if (AddressFamily !=
AddressFamily
.InterNetworkV6)
775
return AddressFamily ==
AddressFamily
.InterNetworkV6 && DualMode;
779
internal bool CanTryAddressFamily(
AddressFamily
family)
781
return (family == _addressFamily) || (family ==
AddressFamily
.InterNetwork && IsDualMode);
858
if (dnsEP.AddressFamily !=
AddressFamily
.Unspecified && !CanTryAddressFamily(dnsEP.AddressFamily))
912
if (_addressFamily !=
AddressFamily
.InterNetwork && _addressFamily !=
AddressFamily
.InterNetworkV6)
947
if (_addressFamily !=
AddressFamily
.InterNetwork && _addressFamily !=
AddressFamily
.InterNetworkV6)
1822
if (endPointSnapshot.AddressFamily ==
AddressFamily
.InterNetwork && IsDualMode)
1864
else if (AddressFamily ==
AddressFamily
.InterNetworkV6 && socketAddress.Family ==
AddressFamily
.InterNetwork)
1946
if (endPointSnapshot.AddressFamily ==
AddressFamily
.InterNetwork && IsDualMode)
1983
else if (endPointSnapshot.AddressFamily ==
AddressFamily
.InterNetworkV6 && socketAddress.Family ==
AddressFamily
.InterNetwork)
2314
if (_addressFamily ==
AddressFamily
.InterNetworkV6)
2318
else if (_addressFamily ==
AddressFamily
.InterNetwork)
2911
if (dnsEP.AddressFamily !=
AddressFamily
.Unspecified && !CanTryAddressFamily(dnsEP.AddressFamily))
2963
bool canUseConnectEx = _socketType == SocketType.Stream && endPointSnapshot.AddressFamily !=
AddressFamily
.Unix;
3004
Socket? attemptSocket = dnsEP.AddressFamily !=
AddressFamily
.Unspecified ? new Socket(dnsEP.AddressFamily, socketType, protocolType) : null;
3027
partial void WildcardBindForConnectIfNecessary(
AddressFamily
addressFamily);
3115
if (endPointSnapshot.AddressFamily ==
AddressFamily
.InterNetwork && IsDualMode)
3316
internal static void GetIPProtocolInformation(
AddressFamily
addressFamily, SocketAddress socketAddress, out bool isIPv4, out bool isIPv6)
3318
bool isIPv4MappedToIPv6 = socketAddress.Family ==
AddressFamily
.InterNetworkV6 && socketAddress.GetIPAddress().IsIPv4MappedToIPv6;
3319
isIPv4 = addressFamily ==
AddressFamily
.InterNetwork || isIPv4MappedToIPv6; // DualMode
3320
isIPv6 = addressFamily ==
AddressFamily
.InterNetworkV6;
3325
AddressFamily
fam = endPoint.AddressFamily;
3327
fam ==
AddressFamily
.InterNetwork ? SocketAddressPal.IPv4AddressSize :
3328
fam ==
AddressFamily
.InterNetworkV6 ? SocketAddressPal.IPv6AddressSize :
3337
if (addr.AddressFamily ==
AddressFamily
.InterNetwork && IsDualMode)
3572
if (_addressFamily ==
AddressFamily
.InterNetwork)
3582
if (_addressFamily ==
AddressFamily
.InterNetworkV6
System\Net\Sockets\Socket.Tasks.cs (1)
418
if (remoteEndPoint!.AddressFamily != AddressFamily && AddressFamily ==
AddressFamily
.InterNetworkV6 && IsDualMode)
System\Net\Sockets\Socket.Unix.cs (2)
62
SafeSocketHandle handle, out
AddressFamily
addressFamily, out SocketType socketType, out ProtocolType protocolType, out bool blocking, out bool isListening, out bool isSocket)
96
addressFamily =
AddressFamily
.Unknown;
System\Net\Sockets\SocketAsyncEventArgs.cs (11)
682
Debug.Assert(endPoint.AddressFamily ==
AddressFamily
.Unspecified ||
683
endPoint.AddressFamily ==
AddressFamily
.InterNetwork ||
684
endPoint.AddressFamily ==
AddressFamily
.InterNetworkV6);
736
if (address.AddressFamily ==
AddressFamily
.InterNetworkV6)
738
attemptSocket = tempSocketIPv6 ??= (Socket.OSSupportsIPv6 ? new Socket(
AddressFamily
.InterNetworkV6, socketType, protocolType) : null);
745
else if (address.AddressFamily ==
AddressFamily
.InterNetwork)
747
attemptSocket = tempSocketIPv4 ??= (Socket.OSSupportsIPv4 ? new Socket(
AddressFamily
.InterNetwork, socketType, protocolType) : null);
966
if (_remoteEndPoint!.AddressFamily ==
AddressFamily
.InterNetworkV6 && _socketAddress!.Family ==
AddressFamily
.InterNetwork)
988
if (_remoteEndPoint!.AddressFamily ==
AddressFamily
.InterNetworkV6 && _socketAddress!.Family ==
AddressFamily
.InterNetwork)
System\Net\Sockets\SocketPal.Unix.cs (3)
37
if (!SupportsDualModeIPv4PacketInfo && socket.AddressFamily ==
AddressFamily
.InterNetworkV6 && socket.DualMode)
59
public static unsafe SocketError CreateSocket(
AddressFamily
addressFamily, SocketType socketType, ProtocolType protocolType, out SafeSocketHandle socket)
75
if (!OperatingSystem.IsWasi() && addressFamily ==
AddressFamily
.InterNetworkV6 && socketType != SocketType.Raw)
System\Net\Sockets\SocketsTelemetry.cs (1)
115
activity.SetTag("network.type", ipEndPoint.AddressFamily ==
AddressFamily
.InterNetwork ? "ipv4" : "ipv6");
System\Net\Sockets\TCPClient.cs (11)
17
private
AddressFamily
_family;
26
public TcpClient() : this(
AddressFamily
.Unknown)
31
public TcpClient(
AddressFamily
family)
35
if (family is not (
AddressFamily
.InterNetwork or
AddressFamily
.InterNetworkV6 or
AddressFamily
.Unknown))
57
public TcpClient(string hostname, int port) : this(
AddressFamily
.Unknown)
101
_family = _clientSocket?.AddressFamily ??
AddressFamily
.Unknown;
374
if (_family ==
AddressFamily
.Unknown)
378
if (_clientSocket.AddressFamily ==
AddressFamily
.InterNetwork)
380
_family =
AddressFamily
.InterNetwork;
System\Net\Sockets\UDPClient.cs (29)
21
private
AddressFamily
_family =
AddressFamily
.InterNetwork;
24
public UdpClient() : this(
AddressFamily
.InterNetwork)
29
public UdpClient(
AddressFamily
family)
31
if (family !=
AddressFamily
.InterNetwork && family !=
AddressFamily
.InterNetworkV6)
47
public UdpClient(int port) : this(port,
AddressFamily
.InterNetwork)
53
public UdpClient(int port,
AddressFamily
family)
59
if (family !=
AddressFamily
.InterNetwork && family !=
AddressFamily
.InterNetworkV6)
67
if (_family ==
AddressFamily
.InterNetwork)
197
private bool IsAddressFamilyCompatible(
AddressFamily
family)
205
if (family ==
AddressFamily
.InterNetwork)
207
return _family ==
AddressFamily
.InterNetworkV6 && _clientSocket.DualMode;
268
if (address.AddressFamily ==
AddressFamily
.InterNetworkV6)
368
EndPoint tempRemoteEP = _family ==
AddressFamily
.InterNetwork ?
381
EndPoint tempRemoteEP = _family ==
AddressFamily
.InterNetwork ?
405
if (_family ==
AddressFamily
.InterNetwork)
425
if (_family !=
AddressFamily
.InterNetwork)
443
if (_family !=
AddressFamily
.InterNetworkV6)
472
(_family ==
AddressFamily
.InterNetwork) ? SocketOptionLevel.IP : SocketOptionLevel.IPv6,
489
if (_family ==
AddressFamily
.InterNetwork)
512
if (_family !=
AddressFamily
.InterNetworkV6)
622
_family ==
AddressFamily
.InterNetwork ? IPEndPointStatics.Any : IPEndPointStatics.IPv6Any));
648
_family ==
AddressFamily
.InterNetwork ? IPEndPointStatics.Any : IPEndPointStatics.IPv6Any, cancellationToken));
714
ipv4Socket = new Socket(
AddressFamily
.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
718
ipv6Socket = new Socket(
AddressFamily
.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp);
732
if (address.AddressFamily ==
AddressFamily
.InterNetwork && ipv4Socket != null)
840
EndPoint tempRemoteEP = _family ==
AddressFamily
.InterNetwork ?
System\Net\Sockets\UnixDomainSocketEndPoint.cs (4)
14
private const
AddressFamily
EndPointAddressFamily =
AddressFamily
.Unix;
69
Debug.Assert(
AddressFamily
.Unix == SocketAddressPal.GetAddressFamily(socketAddress));
119
public override
AddressFamily
AddressFamily => EndPointAddressFamily;
System\Net\Sockets\UnixDomainSocketEndPoint.Unix.cs (1)
34
new SocketAddress(
AddressFamily
.Unix, s_nativePathOffset + _encodedPath.Length);
System.ServiceModel.UnixDomainSocket (2)
System\ServiceModel\Channels\SocketConnection.cs (2)
777
AddressFamily
addressFamily =
AddressFamily
.Unix;