1 type derived from Socket
Microsoft.Diagnostics.NETCore.Client (1)
DiagnosticsIpc\IpcSocket.cs (1)
13
internal class IpcSocket :
Socket
69 instantiations of Socket
aspire (5)
Backchannel\AppHostAuxiliaryBackchannel.cs (1)
146
socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Backchannel\AppHostCliBackchannel.cs (1)
270
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Backchannel\AuxiliaryBackchannelMonitor.cs (1)
349
socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Backchannel\ExtensionBackchannel.cs (1)
169
var socket = new
Socket
(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Projects\AppHostRpcClient.cs (1)
128
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Aspire.Dashboard.Tests (1)
Integration\ServerRetryHelper.cs (1)
166
using var socket = new
Socket
(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Aspire.Hosting (3)
Backchannel\AuxiliaryBackchannelService.cs (1)
78
_serverSocket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Backchannel\BackchannelService.cs (1)
54
var serverSocket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Dcp\DcpHost.cs (1)
323
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Aspire.Hosting.RemoteHost (1)
JsonRpcServer.cs (1)
142
_listenSocket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Aspire.Hosting.Tests (18)
Backchannel\AppHostBackchannelTests.cs (2)
41
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
79
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Backchannel\AuxiliaryBackchannelTests.cs (15)
44
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
83
var client1Socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
84
var client2Socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
85
var client3Socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
125
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
160
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
203
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
245
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
322
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
363
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
400
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
449
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
487
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
530
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
573
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Helpers\Network.cs (1)
51
using var socket = new
Socket
(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
dotnet-svcutil-lib (2)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (2)
927
socket = new
Socket
(addressFamily, SocketType.Stream, ProtocolType.Tcp);
944
socket = new
Socket
(addressFamily, SocketType.Stream, ProtocolType.Tcp);
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.Diagnostics.NETCore.Client (1)
DiagnosticsServerRouter\DiagnosticsServerRouterFactory.cs (1)
467
clientSocket = new
Socket
(SocketType.Stream, ProtocolType.Tcp);
Microsoft.DotNet.HotReload.Watch (1)
src\sdk\src\Dotnet.Watch\AspireService\Helpers\SocketUtilities.cs (1)
63
Socket socket = new
Socket
(addressFamily, SocketType.Stream, ProtocolType.Tcp);
Microsoft.Extensions.Hosting.Systemd (1)
SystemdNotifier.cs (1)
48
using (var socket = new
Socket
(AddressFamily.Unix, SocketType.Dgram, ProtocolType.Unspecified))
Microsoft.Extensions.ServiceDiscovery.Dns (2)
Resolver\DnsResolver.cs (2)
724
using var socket = new
Socket
(serverEndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
774
using var socket = new
Socket
(serverEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (3)
Resolver\LoopbackDnsServer.cs (2)
22
_dnsSocket =
new
(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
79
_tcpSocket =
new
(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Resolver\ResolveAddressesTests.cs (1)
289
using Socket socket = new
Socket
(clientAddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
System.IO.Pipes (3)
Microsoft\Win32\SafeHandles\SafePipeHandle.Unix.cs (1)
84
socket = SetPipeSocketInterlocked(new
Socket
(new SafeSocketHandle(handle, ownsHandle)), ownsHandle);
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)
335
var socket = new
Socket
(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
System.Net.Http (1)
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (1)
682
Socket socket = new
Socket
(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true };
System.Net.HttpListener (1)
System\Net\Managed\HttpEndPointListener.cs (1)
63
_socket = new
Socket
(addr.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
System.Net.NetworkInformation (1)
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (1)
169
Socket = new
Socket
(sh);
System.Net.Ping (2)
src\runtime\src\libraries\Common\src\System\Net\RawSocketPermissions.cs (1)
25
new
Socket
(addressFamily, SocketType.Raw, addressFamily == AddressFamily.InterNetwork ? ProtocolType.Icmp : ProtocolType.IcmpV6).Dispose();
System\Net\NetworkInformation\Ping.RawSocket.cs (1)
72
Socket socket = new
Socket
(addrFamily, socketType, socketConfig.ProtocolType);
System.Net.Requests (4)
System\Net\FtpControlStream.cs (1)
1168
Socket socket = new
Socket
(templateSocket.AddressFamily, templateSocket.SocketType, templateSocket.ProtocolType);
System\Net\FtpWebRequest.cs (2)
956
var client = new
Socket
(SocketType.Stream, ProtocolType.Tcp);
973
var client = new
Socket
(SocketType.Stream, ProtocolType.Tcp);
System\Net\HttpWebRequest.cs (1)
1791
var socket = new
Socket
(SocketType.Stream, ProtocolType.Tcp);
System.Net.Sockets (14)
System\Net\Sockets\Socket.cs (3)
3019
Socket? attemptSocket = dnsEP.AddressFamily != AddressFamily.Unspecified ? new
Socket
(dnsEP.AddressFamily, socketType, protocolType) : null;
3034
Socket attemptSocket = new
Socket
(endPointSnapshot.AddressFamily, socketType, protocolType);
3799
Socket socket = new
Socket
(fd, loadPropertiesFromHandle: false);
System\Net\Sockets\SocketAsyncEventArgs.cs (2)
769
attemptSocket = tempSocketIPv6 ??= (Socket.OSSupportsIPv6 ? new
Socket
(AddressFamily.InterNetworkV6, socketType, protocolType) : null);
778
attemptSocket = tempSocketIPv4 ??= (Socket.OSSupportsIPv4 ? new
Socket
(AddressFamily.InterNetwork, socketType, protocolType) : null);
System\Net\Sockets\TCPClient.cs (2)
374
_clientSocket = new
Socket
(SocketType.Stream, ProtocolType.Tcp);
382
_clientSocket = new
Socket
(_family, SocketType.Stream, ProtocolType.Tcp);
System\Net\Sockets\TCPListener.cs (4)
29
_serverSocket = new
Socket
(_serverSocketEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
45
_serverSocket = new
Socket
(_serverSocketEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
58
_serverSocket = new
Socket
(_serverSocketEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
273
_serverSocket ??= new
Socket
(_serverSocketEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
System\Net\Sockets\UDPClient.cs (3)
668
_clientSocket = new
Socket
(_family, SocketType.Dgram, ProtocolType.Udp);
719
ipv4Socket = new
Socket
(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
723
ipv6Socket = new
Socket
(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp);
System.ServiceModel.NetTcp (1)
System\ServiceModel\Channels\SocketConnection.cs (1)
814
socket = new
Socket
(addressFamily, SocketType.Stream, ProtocolType.Tcp);
System.ServiceModel.UnixDomainSocket (1)
System\ServiceModel\Channels\SocketConnection.cs (1)
778
socket = new
Socket
(addressFamily, SocketType.Stream, ProtocolType.IP);
468 references to Socket
aspire (5)
Backchannel\AppHostAuxiliaryBackchannel.cs (1)
137
Socket
? socket = null,
Backchannel\AppHostCliBackchannel.cs (1)
270
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Backchannel\AuxiliaryBackchannelMonitor.cs (1)
326
Socket
? socket = null;
Backchannel\ExtensionBackchannel.cs (1)
169
var
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Projects\AppHostRpcClient.cs (1)
128
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Aspire.Dashboard.Tests (1)
Integration\ServerRetryHelper.cs (1)
166
using
var
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Aspire.Hosting (14)
Backchannel\AuxiliaryBackchannelConnectedEvent.cs (2)
11
internal sealed class AuxiliaryBackchannelConnectedEvent(IServiceProvider serviceProvider, string socketPath, System.Net.Sockets.
Socket
clientSocket) : IDistributedApplicationEvent
26
public System.Net.Sockets.
Socket
ClientSocket { get; } = clientSocket;
Backchannel\AuxiliaryBackchannelService.cs (3)
24
private
Socket
? _serverSocket;
91
var
clientSocket = await _serverSocket.AcceptAsync(stoppingToken).ConfigureAwait(false);
133
private async Task HandleClientConnectionAsync(
Socket
clientSocket, CancellationToken stoppingToken)
Backchannel\BackchannelService.cs (3)
23
private
Socket
? _serverSocket;
54
var
serverSocket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
66
var
clientSocket = await serverSocket.AcceptAsync(stoppingToken).ConfigureAwait(false);
Dcp\DcpHost.cs (6)
214
var
loggingSocket = CreateLoggingSocket(_locations.DcpLogSocket);
308
private static
Socket
CreateLoggingSocket(string socketPath)
323
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
329
private async Task StartLoggingSocketAsync(
Socket
socket)
336
var
acceptedSocket = await socket.AcceptAsync(_shutdownCts.Token).ConfigureAwait(false);
349
private async Task LogSocketOutputAsync(
Socket
socket, CancellationToken cancellationToken)
Aspire.Hosting.RemoteHost (2)
JsonRpcServer.cs (2)
26
private
Socket
? _listenSocket;
160
var
clientSocket = await _listenSocket.AcceptAsync(cancellationToken).ConfigureAwait(false);
Aspire.Hosting.Tests (18)
Backchannel\AppHostBackchannelTests.cs (2)
41
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
79
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Backchannel\AuxiliaryBackchannelTests.cs (15)
44
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
83
var
client1Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
84
var
client2Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
85
var
client3Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
125
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
160
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
203
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
245
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
322
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
363
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
400
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
449
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
487
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
530
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
573
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Helpers\Network.cs (1)
51
using
var
socket = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
dotnet-svcutil-lib (4)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (4)
22
private
Socket
_socket;
40
public CoreClrSocketConnection(
Socket
socket, ConnectionBufferPool connectionBufferPool)
923
Socket
socket = null;
940
Socket
socket = null;
Microsoft.AspNetCore.Connections.Abstractions (1)
Features\IConnectionSocketFeature.cs (1)
16
Socket
Socket { get; }
Microsoft.AspNetCore.InternalTesting (5)
HttpClientSlim.cs (5)
152
var
socket = await GetSocket(requestUri).ConfigureAwait(false);
171
public static async Task<
Socket
> GetSocket(Uri requestUri)
173
var tcs = new TaskCompletionSource<
Socket
>();
180
if (
Socket
.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, socketArgs))
185
var
socket = socketArgs.ConnectSocket;
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)
21
private
Socket
_portSelector;
Microsoft.AspNetCore.Server.Kestrel.Core (1)
AnyIPListenOptions.cs (1)
15
: base(new IPEndPoint(
Socket
.OSSupportsIPv6 ? IPAddress.IPv6Any : IPAddress.Any, port))
Microsoft.Diagnostics.NETCore.Client (11)
DiagnosticsIpc\ExposedSocketNetworkStream.cs (2)
11
public ExposedSocketNetworkStream(
Socket
socket, bool ownsSocket)
16
public new
Socket
Socket => base.Socket;
DiagnosticsIpc\IpcServerTransport.cs (4)
203
Socket
socket = await _socket.AcceptAsync(linkedSource.Token).ConfigureAwait(false);
224
internal abstract bool OnAccept(
Socket
socket);
242
internal override bool OnAccept(
Socket
socket)
277
internal override bool OnAccept(
Socket
socket)
DiagnosticsIpc\IpcSocket.cs (1)
27
public async Task<
Socket
> AcceptAsync(CancellationToken token)
DiagnosticsIpc\IpcTcpSocketEndPoint.cs (1)
127
if (
Socket
.OSSupportsIPv6)
DiagnosticsServerRouter\DiagnosticsServerRouterFactory.cs (2)
464
Socket
clientSocket;
514
private async Task ConnectAsyncInternal(
Socket
clientSocket, EndPoint remoteEP, CancellationToken token)
ReversedServer\ReversedDiagnosticsServer.cs (1)
384
Socket
socket = networkStream.Socket;
Microsoft.DotNet.HotReload.Watch (3)
src\sdk\src\Dotnet.Watch\AspireService\Helpers\SocketUtilities.cs (3)
57
var sockets = new List<
Socket
>();
63
Socket
socket = new Socket(addressFamily, SocketType.Stream, ProtocolType.Tcp);
85
foreach (
var
socket in sockets)
Microsoft.Extensions.Hosting.Systemd (1)
SystemdNotifier.cs (1)
48
using (
var
socket = new Socket(AddressFamily.Unix, SocketType.Dgram, ProtocolType.Unspecified))
Microsoft.Extensions.ServiceDiscovery.Dns (8)
Resolver\DnsResolver.cs (8)
115
int len = (
Socket
.OSSupportsIPv4 ? 1 : 0) + (
Socket
.OSSupportsIPv6 ? 1 : 0);
119
if (
Socket
.OSSupportsIPv6) // prefer IPv6
124
if (
Socket
.OSSupportsIPv4)
157
if (addressFamily == AddressFamily.InterNetwork &&
Socket
.OSSupportsIPv4)
161
else if (addressFamily == AddressFamily.InterNetworkV6 &&
Socket
.OSSupportsIPv6)
724
using
var
socket = new Socket(serverEndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
774
using
var
socket = new Socket(serverEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (4)
Resolver\LoopbackDnsServer.cs (3)
15
private readonly
Socket
_dnsSocket;
16
private
Socket
? _tcpSocket;
84
using
Socket
tcpClient = await _tcpSocket.AcceptAsync();
Resolver\ResolveAddressesTests.cs (1)
289
using
Socket
socket = new Socket(clientAddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
Microsoft.TestPlatform.CommunicationUtilities (1)
SocketCommunicationManager.cs (1)
77
private
Socket
? _socket;
netstandard (1)
netstandard.cs (1)
1268
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
Socket
))]
System (1)
src\runtime\src\libraries\shims\System\ref\System.cs (1)
758
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
Socket
))]
System.IO.Pipes (16)
Microsoft\Win32\SafeHandles\SafePipeHandle.Unix.cs (9)
25
private
Socket
? _pipeSocket;
29
internal SafePipeHandle(
Socket
namedPipeSocket) : base(ownsHandle: true)
35
internal
Socket
PipeSocket => _pipeSocket ?? CreatePipeSocket();
43
if (disposing && Volatile.Read(ref _pipeSocket) is
Socket
socket)
74
private
Socket
CreatePipeSocket(bool ownsHandle = true)
76
Socket
? socket = null;
108
private
Socket
SetPipeSocketInterlocked(
Socket
socket, bool ownsHandle)
113
Socket
? current = Interlocked.CompareExchange(ref _pipeSocket, socket, null);
System\IO\Pipes\NamedPipeClientStream.Unix.cs (1)
38
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
System\IO\Pipes\NamedPipeServerStream.Unix.cs (5)
64
Socket
accepted = _instance!.ListeningSocket.AcceptAsync().GetAwaiter().GetResult();
82
Socket
acceptedSocket;
101
private void HandleAcceptedSocket(
Socket
acceptedSocket)
241
internal
Socket
ListeningSocket { get; }
335
var
socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
System\IO\Pipes\PipeStream.Unix.cs (1)
489
Socket
s, SafePipeHandle _,
System.Net (1)
System.Net.cs (1)
39
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
Socket
))]
System.Net.Http (2)
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (2)
682
Socket
socket = new Socket(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true };
691
using (cancellationToken.UnsafeRegister(static s => ((
Socket
)s!).Dispose(), socket))
System.Net.HttpListener (5)
System\Net\Managed\HttpConnection.cs (3)
49
private
Socket
? _socket;
74
public HttpConnection(
Socket
sock, HttpEndPointListener epl, bool secure, X509Certificate cert)
533
Socket
s = _socket;
System\Net\Managed\HttpEndPointListener.cs (2)
44
private readonly
Socket
_socket;
110
Socket
? accepted = args.SocketError == SocketError.Success ? args.AcceptSocket : null;
System.Net.NetworkInformation (10)
System\Net\NetworkInformation\LinuxIPGlobalProperties.cs (6)
11
return StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(
Socket
.OSSupportsIPv4 ? NetworkFiles.Tcp4ConnectionsFile : null,
12
Socket
.OSSupportsIPv6 ? NetworkFiles.Tcp6ConnectionsFile : null);
17
return StringParsingHelpers.ParseActiveTcpListenersFromFiles(
Socket
.OSSupportsIPv4 ? NetworkFiles.Tcp4ConnectionsFile : null,
18
Socket
.OSSupportsIPv6 ? NetworkFiles.Tcp6ConnectionsFile : null);
23
return StringParsingHelpers.ParseActiveUdpListenersFromFiles(
Socket
.OSSupportsIPv4 ? NetworkFiles.Udp4ConnectionsFile : null,
24
Socket
.OSSupportsIPv6 ? NetworkFiles.Udp6ConnectionsFile : null);
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (4)
18
private static
Socket
? s_socket;
20
private static
Socket
? Socket
185
private static async Task ReadEventsAsync(
Socket
socket)
219
static unsafe Interop.Error ReadEvents(
Socket
socket)
System.Net.Ping (5)
System\Net\NetworkInformation\Ping.RawSocket.cs (5)
64
private static
Socket
GetRawSocket(SocketConfig socketConfig)
72
Socket
socket = new Socket(addrFamily, socketType, socketConfig.ProtocolType);
253
using (
Socket
socket = GetRawSocket(socketConfig))
300
private static unsafe PingReply CreatePingReplyForUnreachableHost(IPAddress address,
Socket
socket)
325
using
Socket
socket = GetRawSocket(socketConfig);
System.Net.Quic (1)
System\Net\Quic\Internal\MsQuicApi.cs (1)
84
if (!
Socket
.OSSupportsIPv6)
System.Net.Requests (13)
System\Net\FtpControlStream.cs (7)
31
private
Socket
? _dataSocket;
89
Socket
? socket = _dataSocket;
108
Socket
listenSocket = connection._dataSocket!;
741
Socket
listenSocket = _dataSocket!;
1165
private static
Socket
CreateFtpDataSocket(
Socket
templateSocket)
1168
Socket
socket = new Socket(templateSocket.AddressFamily, templateSocket.SocketType, templateSocket.ProtocolType);
System\Net\FtpWebRequest.cs (2)
956
var
client = new Socket(SocketType.Stream, ProtocolType.Tcp);
973
var
client = new Socket(SocketType.Stream, ProtocolType.Tcp);
System\Net\HttpWebRequest.cs (3)
1791
var
socket = new Socket(SocketType.Stream, ProtocolType.Tcp);
1814
static void BindHelper(ServicePoint servicePoint, ref IPAddress[] addresses,
Socket
socket, int port)
1861
using (cancellationToken.UnsafeRegister(s => ((
Socket
)s!).Dispose(), socket))
System\Net\NetworkStreamWrapper.cs (1)
39
internal
Socket
Socket
System.Net.Sockets (320)
System\Net\Sockets\NetEventSource.Sockets.cs (4)
19
public static void Accepted(
Socket
socket, object? remoteEp, object? localEp) =>
27
public static void Connected(
Socket
socket, object? localEp, object? remoteEp) =>
35
public static void ConnectedAsyncDns(
Socket
socket) =>
43
public static void NotLoggedFile(string filePath,
Socket
socket, SocketAsyncOperation completedOperation) =>
System\Net\Sockets\NetworkStream.cs (16)
15
private readonly
Socket
_streamSocket;
30
public NetworkStream(
Socket
socket)
35
public NetworkStream(
Socket
socket, bool ownsSocket)
40
public NetworkStream(
Socket
socket, FileAccess access)
45
public NetworkStream(
Socket
socket, FileAccess access, bool ownsSocket)
85
public
Socket
Socket => _streamSocket;
229
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
250
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
275
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
299
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
322
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
349
private int _closeTimeout =
Socket
.DefaultCloseTimeout; // -1 = respect linger options
435
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
470
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
501
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
533
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
System\Net\Sockets\Socket.cs (128)
69
private int _closeTimeout =
Socket
.DefaultCloseTimeout;
103
/// <summary>Initializes a new instance of the <see cref="
Socket
"/> class for the specified socket handle.</summary>
104
/// <param name="handle">The socket handle for the socket that the <see cref="
Socket
"/> object will encapsulate.</param>
109
/// This method populates the <see cref="
Socket
"/> instance with data gathered from the supplied <see cref="SafeSocketHandle"/>.
111
/// properties and configuration, which means some of the public APIs on the resulting <see cref="
Socket
"/> instance may
112
/// differ based on operating system, such as <see cref="
Socket
.ProtocolType"/> and <see cref="
Socket
.Blocking"/>.
173
if (!
Socket
.OSSupportsUnixDomainSockets) throw new PlatformNotSupportedException();
207
if (!
Socket
.OSSupportsUnixDomainSockets) throw new PlatformNotSupportedException();
834
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
878
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
903
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
934
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1001
/// Places a <see cref="
Socket
"/> in a listening state.
1009
/// Places a <see cref="
Socket
"/> in a listening state.
1029
public
Socket
Accept()
1031
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1092
Socket
socket = CreateAcceptSocket(acceptedSocketHandle, _rightEndPoint.Create(socketAddress));
1100
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1107
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1114
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1121
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1128
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1141
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1179
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1192
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1233
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1243
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1270
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1276
/// Sends the file <paramref name="fileName"/> and buffers of data to a connected <see cref="
Socket
"/> object
1291
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> object has been closed.</exception>
1292
/// <exception cref="NotSupportedException">The <see cref="
Socket
"/> object is not connected to a remote host.</exception>
1293
/// <exception cref="InvalidOperationException">The <see cref="
Socket
"/> object is not in blocking mode and cannot accept this synchronous call.</exception>
1298
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1304
/// Sends the file <paramref name="fileName"/> and buffers of data to a connected <see cref="
Socket
"/> object
1319
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> object has been closed.</exception>
1320
/// <exception cref="NotSupportedException">The <see cref="
Socket
"/> object is not connected to a remote host.</exception>
1321
/// <exception cref="InvalidOperationException">The <see cref="
Socket
"/> object is not in blocking mode and cannot accept this synchronous call.</exception>
1326
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1352
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1390
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1397
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1404
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1417
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
1420
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1434
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
1437
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1477
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
1480
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1509
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1516
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1523
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1531
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1544
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1578
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1588
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1615
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1622
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1635
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1674
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1743
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> object has been closed.</exception>
1746
/// <see cref="
Socket
.ReceiveMessageFrom(Span{byte}, ref SocketFlags, ref EndPoint, out IPPacketInformation)"/>
1749
/// <para>The <see cref="
Socket
"/> object is not in blocking mode and cannot accept this synchronous call.</para>
1753
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1815
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1896
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1903
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1910
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1923
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
1938
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
1941
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2021
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
2024
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2169
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
2172
/// In general, the SetSocketOption method should be used whenever setting a <see cref="
Socket
"/> option.
2289
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
2292
/// In general, the GetSocketOption method should be used whenever getting a <see cref="
Socket
"/> option.
2335
/// <summary>Determines the status of the <see cref="
Socket
"/>.</summary>
2339
/// The status of the <see cref="
Socket
"/> based on the polling mode value passed in the <paramref name="mode"/> parameter.
2349
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
2352
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2369
/// <summary>Determines the status of the <see cref="
Socket
"/>.</summary>
2373
/// The status of the <see cref="
Socket
"/> based on the polling mode value passed in the <paramref name="mode"/> parameter.
2384
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> has been closed.</exception>
2389
/// <param name="checkRead">An <see cref="IList"/> of <see cref="
Socket
"/> instances to check for readability.</param>
2390
/// <param name="checkWrite">An <see cref="IList"/> of <see cref="
Socket
"/> instances to check for writability.</param>
2391
/// <param name="checkError">An <see cref="IList"/> of <see cref="
Socket
"/> instances to check for errors.</param>
2399
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2431
/// <param name="checkRead">An <see cref="IList"/> of <see cref="
Socket
"/> instances to check for readability.</param>
2432
/// <param name="checkWrite">An <see cref="IList"/> of <see cref="
Socket
"/> instances to check for writability.</param>
2433
/// <param name="checkError">An <see cref="IList"/> of <see cref="
Socket
"/> instances to check for errors.</param>
2499
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2509
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2527
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2536
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2558
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2565
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2583
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2597
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2606
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2624
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2632
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2654
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2672
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2695
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2715
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2735
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2754
public
Socket
EndAccept(IAsyncResult asyncResult) => TaskToAsyncResult.End<
Socket
>(asyncResult);
2759
private async Task<(
Socket
s, byte[] buffer, int bytesReceived)> AcceptAndReceiveHelperAsync(
Socket
? acceptSocket, int receiveSize)
2763
Socket
s = await AcceptAsync(acceptSocket).ConfigureAwait(false);
2792
public IAsyncResult BeginAccept(
Socket
? acceptSocket, int receiveSize, AsyncCallback? callback, object? state) =>
2795
public
Socket
EndAccept(out byte[] buffer, IAsyncResult asyncResult)
2797
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2799
Socket
socket = EndAccept(out byte[] innerBuffer, out int bytesTransferred, asyncResult);
2805
public
Socket
EndAccept(out byte[] buffer, out int bytesTransferred, IAsyncResult asyncResult)
2807
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2809
Socket
s;
2810
(s, buffer, bytesTransferred) = TaskToAsyncResult.End<(
Socket
, byte[], int)>(asyncResult);
3019
Socket
? attemptSocket = dnsEP.AddressFamily != AddressFamily.Unspecified ? new Socket(dnsEP.AddressFamily, socketType, protocolType) : null;
3034
Socket
attemptSocket = new Socket(endPointSnapshot.AddressFamily, socketType, protocolType);
3795
internal
Socket
CreateAcceptSocket(SafeSocketHandle fd, EndPoint? remoteEP)
3799
Socket
socket = new Socket(fd, loadPropertiesFromHandle: false);
3803
internal
Socket
UpdateAcceptSocket(
Socket
socket, EndPoint? remoteEP)
4067
Socket
socket = (
Socket
)socketList[i]!;
System\Net\Sockets\Socket.Tasks.cs (40)
32
public Task<
Socket
> AcceptAsync() => AcceptAsync((
Socket
?)null, CancellationToken.None).AsTask();
39
public ValueTask<
Socket
> AcceptAsync(CancellationToken cancellationToken) => AcceptAsync((
Socket
?)null, cancellationToken);
46
public Task<
Socket
> AcceptAsync(
Socket
? acceptSocket) => AcceptAsync(acceptSocket, CancellationToken.None).AsTask();
54
public ValueTask<
Socket
> AcceptAsync(
Socket
? acceptSocket, CancellationToken cancellationToken)
58
return ValueTask.FromCanceled<
Socket
>(cancellationToken);
330
saea.Completed += (s, e) => CompleteSendReceive((
Socket
)s!, (TaskSocketAsyncEventArgs<int>)e, isReceive: true);
594
saea.Completed += (s, e) => CompleteSendReceive((
Socket
)s!, (TaskSocketAsyncEventArgs<int>)e, isReceive: false);
703
/// Sends the file <paramref name="fileName"/> to a connected <see cref="
Socket
"/> object.
707
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> object has been closed.</exception>
708
/// <exception cref="NotSupportedException">The <see cref="
Socket
"/> object is not connected to a remote host.</exception>
717
/// Sends the file <paramref name="fileName"/> and buffers of data to a connected <see cref="
Socket
"/> object
725
/// <exception cref="ObjectDisposedException">The <see cref="
Socket
"/> object has been closed.</exception>
726
/// <exception cref="NotSupportedException">The <see cref="
Socket
"/> object is not connected to a remote host.</exception>
872
private static void CompleteSendReceive(
Socket
s, TaskSocketAsyncEventArgs<int> saea, bool isReceive)
977
internal sealed class AwaitableSocketAsyncEventArgs : SocketAsyncEventArgs, IValueTaskSource, IValueTaskSource<int>, IValueTaskSource<
Socket
>, IValueTaskSource<SocketReceiveFromResult>, IValueTaskSource<SocketReceiveMessageFromResult>
980
private readonly
Socket
_owner;
989
public AwaitableSocketAsyncEventArgs(
Socket
owner, bool isReceiveForCaching) :
1021
public ValueTask<
Socket
> AcceptAsync(
Socket
socket, CancellationToken cancellationToken)
1026
return new ValueTask<
Socket
>(this, _mrvtsc.Version);
1029
Socket
acceptSocket = AcceptSocket!;
1037
new ValueTask<
Socket
>(acceptSocket) :
1038
ValueTask.FromException<
Socket
>(CreateException(error));
1043
public ValueTask<int> ReceiveAsync(
Socket
socket, CancellationToken cancellationToken)
1061
public ValueTask<SocketReceiveFromResult> ReceiveFromAsync(
Socket
socket, CancellationToken cancellationToken)
1080
internal ValueTask<int> ReceiveFromSocketAddressAsync(
Socket
socket, CancellationToken cancellationToken)
1098
public ValueTask<SocketReceiveMessageFromResult> ReceiveMessageFromAsync(
Socket
socket, CancellationToken cancellationToken)
1121
public ValueTask<int> SendAsync(
Socket
socket, CancellationToken cancellationToken)
1139
public ValueTask SendAsyncForNetworkStream(
Socket
socket, CancellationToken cancellationToken)
1156
public ValueTask SendPacketsAsync(
Socket
socket, CancellationToken cancellationToken)
1173
public ValueTask<int> SendToAsync(
Socket
socket, CancellationToken cancellationToken)
1191
public ValueTask ConnectAsync(
Socket
socket, CancellationToken cancellationToken)
1216
public ValueTask DisconnectAsync(
Socket
socket, CancellationToken cancellationToken)
1285
Socket
IValueTaskSource<
Socket
>.GetResult(short token)
1293
Socket
acceptSocket = AcceptSocket!;
System\Net\Sockets\Socket.Unix.cs (5)
171
private
Socket
? GetOrCreateAcceptSocket(
Socket
? acceptSocket, bool checkDisconnected, string propertyName, out SafeSocketHandle? handle)
251
internal
Socket
CopyStateFromSource(
Socket
source)
275
foreach (PropertyInfo pi in typeof(
Socket
).GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
System\Net\Sockets\SocketAsyncContext.Unix.cs (12)
1284
[DynamicDependency("set_PreferInlineCompletions", typeof(
Socket
))]
1396
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
1533
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
1638
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
1671
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
1783
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
1852
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
1889
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
1981
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
2013
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
2092
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
2162
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException();
System\Net\Sockets\SocketAsyncEventArgs.cs (15)
17
private
Socket
? _acceptSocket;
18
private
Socket
? _connectSocket;
76
private
Socket
? _currentSocket;
106
public
Socket
? AcceptSocket
112
public
Socket
? ConnectSocket
550
internal void StartOperationCommon(
Socket
? socket, SocketAsyncOperation operation)
581
_acceptAddressBufferCount = 2 * (
Socket
.GetAddressSize(_currentSocket!._rightEndPoint!) + 16);
639
Socket
? currentSocket = _currentSocket;
703
Socket
.OSSupportsIPv6 &&
Socket
.OSSupportsIPv4;
742
Socket
? tempSocketIPv4 = null, tempSocketIPv6 = null;
751
Socket
? attemptSocket = null;
769
attemptSocket = tempSocketIPv6 ??= (
Socket
.OSSupportsIPv6 ? new Socket(AddressFamily.InterNetworkV6, socketType, protocolType) : null);
778
attemptSocket = tempSocketIPv4 ??= (
Socket
.OSSupportsIPv4 ? new Socket(AddressFamily.InterNetwork, socketType, protocolType) : null);
951
public void SetResults(
Socket
? socket, SocketError socketError, int bytesTransferred, SocketFlags flags, Exception? exception)
System\Net\Sockets\SocketAsyncEventArgs.Unix.cs (7)
46
internal SocketError DoOperationAccept(
Socket
_ /*socket*/, SafeSocketHandle handle, SafeSocketHandle? acceptHandle, CancellationToken cancellationToken)
74
internal SocketError DoOperationConnectEx(
Socket
_ /*socket*/, SafeSocketHandle handle, CancellationToken cancellationToken)
94
internal SocketError DoOperationDisconnect(
Socket
socket, SafeSocketHandle handle, CancellationToken _ /*cancellationToken*/)
196
internal SocketError DoOperationReceiveMessageFrom(
Socket
socket, SafeSocketHandle handle, CancellationToken cancellationToken)
203
Socket
.GetIPProtocolInformation(socket.AddressFamily, _socketAddress!, out isIPv4, out isIPv6);
244
internal SocketError DoOperationSendPackets(
Socket
socket, SafeSocketHandle _1 /*handle*/, CancellationToken cancellationToken)
351
Socket
acceptedSocket = _currentSocket!.CreateAcceptSocket(
System\Net\Sockets\SocketPal.Unix.cs (29)
35
public static void CheckDualModePacketInfoSupport(
Socket
socket)
1304
public static SocketError ReceiveMessageFrom(
Socket
socket, SafeSocketHandle handle, byte[] buffer, int offset, int count, ref SocketFlags socketFlags, SocketAddress socketAddress, out SocketAddress receiveAddress, out IPPacketInformation ipPacketInformation, out int bytesTransferred)
1309
Socket
.GetIPProtocolInformation(socket.AddressFamily, socketAddress, out isIPv4, out isIPv6);
1330
public static SocketError ReceiveMessageFrom(
Socket
socket, SafeSocketHandle handle, Span<byte> buffer, ref SocketFlags socketFlags, SocketAddress socketAddress, out SocketAddress receiveAddress, out IPPacketInformation ipPacketInformation, out int bytesTransferred)
1335
Socket
.GetIPProtocolInformation(socket.AddressFamily, socketAddress, out isIPv4, out isIPv6);
1583
public static void SetReceivingDualModeIPv4PacketInformation(
Socket
socket)
1594
public static void SetIPProtectionLevel(
Socket
socket, SocketOptionLevel optionLevel, int protectionLevel)
1857
Socket
.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1858
Socket
.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1859
Socket
.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
1878
Socket
.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1879
Socket
.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1880
Socket
.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
1897
Socket
? socket = socketList[i] as
Socket
;
1900
throw new ArgumentException(SR.Format(SR.net_sockets_select, socket?.GetType().FullName ?? "null", typeof(
Socket
).FullName), nameof(socketList));
1965
Socket
.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1966
Socket
.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1967
Socket
.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
1986
Socket
.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1987
Socket
.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1988
Socket
.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
2004
Socket
? socket = socketList[i] as
Socket
;
2007
throw new ArgumentException(SR.Format(SR.net_sockets_select, socket?.GetType().FullName ?? "null", typeof(
Socket
).FullName), nameof(socketList));
2041
Socket
socket = (
Socket
)socketList[i]!;
2082
Socket
socket, TransmitFileOptions options, SendPacketsElement[] elements, SafeFileHandle[] fileHandles, CancellationToken cancellationToken, Action<long, SocketError> callback)
2157
internal static SocketError Disconnect(
Socket
socket, SafeSocketHandle handle, bool reuseSocket)
System\Net\Sockets\SocketTaskExtensions.cs (22)
15
public static Task<
Socket
> AcceptAsync(this
Socket
socket) =>
18
public static Task<
Socket
> AcceptAsync(this
Socket
socket,
Socket
? acceptSocket) =>
22
public static Task ConnectAsync(this
Socket
socket, EndPoint remoteEP) =>
25
public static ValueTask ConnectAsync(this
Socket
socket, EndPoint remoteEP, CancellationToken cancellationToken) =>
28
public static Task ConnectAsync(this
Socket
socket, IPAddress address, int port) =>
31
public static ValueTask ConnectAsync(this
Socket
socket, IPAddress address, int port, CancellationToken cancellationToken) =>
34
public static Task ConnectAsync(this
Socket
socket, IPAddress[] addresses, int port) =>
37
public static ValueTask ConnectAsync(this
Socket
socket, IPAddress[] addresses, int port, CancellationToken cancellationToken) =>
40
public static Task ConnectAsync(this
Socket
socket, string host, int port) =>
43
public static ValueTask ConnectAsync(this
Socket
socket, string host, int port, CancellationToken cancellationToken) =>
47
public static Task<int> ReceiveAsync(this
Socket
socket, ArraySegment<byte> buffer, SocketFlags socketFlags) =>
50
public static ValueTask<int> ReceiveAsync(this
Socket
socket, Memory<byte> buffer, SocketFlags socketFlags, CancellationToken cancellationToken = default) =>
53
public static Task<int> ReceiveAsync(this
Socket
socket, IList<ArraySegment<byte>> buffers, SocketFlags socketFlags) =>
56
public static Task<SocketReceiveFromResult> ReceiveFromAsync(this
Socket
socket, ArraySegment<byte> buffer, SocketFlags socketFlags, EndPoint remoteEndPoint) =>
59
public static Task<SocketReceiveMessageFromResult> ReceiveMessageFromAsync(this
Socket
socket, ArraySegment<byte> buffer, SocketFlags socketFlags, EndPoint remoteEndPoint) =>
63
public static Task<int> SendAsync(this
Socket
socket, ArraySegment<byte> buffer, SocketFlags socketFlags) =>
66
public static ValueTask<int> SendAsync(this
Socket
socket, ReadOnlyMemory<byte> buffer, SocketFlags socketFlags, CancellationToken cancellationToken = default) =>
69
public static Task<int> SendAsync(this
Socket
socket, IList<ArraySegment<byte>> buffers, SocketFlags socketFlags) =>
73
public static Task<int> SendToAsync(this
Socket
socket, ArraySegment<byte> buffer, SocketFlags socketFlags, EndPoint remoteEP) =>
System\Net\Sockets\TCPClient.cs (9)
18
private
Socket
_clientSocket = null!; // initialized by helper called from ctor
79
internal TcpClient(
Socket
acceptedSocket)
95
public
Socket
Client
123
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
142
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
159
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
172
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
239
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
279
Socket
chkClientSocket = Volatile.Read(ref _clientSocket);
System\Net\Sockets\TCPListener.cs (12)
17
private
Socket
? _serverSocket;
62
public
Socket
Server
184
public
Socket
AcceptSocket()
205
Socket
acceptedSocket = _serverSocket!.Accept();
212
public
Socket
EndAcceptSocket(IAsyncResult asyncResult) =>
213
EndAcceptCore<
Socket
>(asyncResult);
221
public Task<
Socket
> AcceptSocketAsync() => AcceptSocketAsync(CancellationToken.None).AsTask();
223
public ValueTask<
Socket
> AcceptSocketAsync(CancellationToken cancellationToken)
239
static async ValueTask<TcpClient> WaitAndWrap(ValueTask<
Socket
> task) =>
252
if (
Socket
.OSSupportsIPv6)
290
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
300
throw new ObjectDisposedException(typeof(
Socket
).FullName);
System\Net\Sockets\UDPClient.cs (20)
18
private
Socket
_clientSocket = null!; // initialized by helper called from ctor
117
public
Socket
Client
234
Socket
chkClientSocket = _clientSocket;
292
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
309
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
366
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
382
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
644
/// <exception cref="ObjectDisposedException">The underlying <see cref="
Socket
"/> has been closed.</exception>
693
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
710
Socket
? ipv6Socket = null;
711
Socket
? ipv4Socket = null;
717
if (
Socket
.OSSupportsIPv4)
721
if (
Socket
.OSSupportsIPv6)
808
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
825
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
838
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
861
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
897
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
941
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
967
if (!
Socket
.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
System\Net\Sockets\UnixDomainSocketEndPoint.cs (1)
59
if (!
Socket
.OSSupportsUnixDomainSockets)
System.ServiceModel.NetTcp (6)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (2)
31
public ValueTask<int> ReceiveAsync(
Socket
socket, Memory<byte> buffer)
48
public ValueTask SendAsync(
Socket
socket, ReadOnlyMemory<byte> memory)
System\ServiceModel\Channels\SocketConnection.cs (4)
21
private
Socket
_socket;
72
public SocketConnection(
Socket
socket, int bufferSize)
810
Socket
socket = null;
883
if (
Socket
.OSSupportsIPv6)
System.ServiceModel.UnixDomainSocket (5)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (2)
31
public ValueTask<int> ReceiveAsync(
Socket
socket, Memory<byte> buffer)
48
public ValueTask SendAsync(
Socket
socket, ReadOnlyMemory<byte> memory)
System\ServiceModel\Channels\SocketConnection.cs (3)
19
private
Socket
_socket;
54
public SocketConnection(
Socket
socket, int bufferSize)
774
Socket
socket = null;