1 type derived from Socket
Microsoft.Diagnostics.NETCore.Client (1)
123 instantiations of Socket
aspire (5)
aspire-managed (1)
Aspire.Cli.Tests (9)
Aspire.Dashboard.Tests (2)
Aspire.Hosting (6)
Aspire.Hosting.CodeGeneration.Go.Tests (1)
Aspire.Hosting.Native.Client (1)
Aspire.Hosting.Native.Core.Tests (6)
Aspire.Hosting.Native.Server (4)
Aspire.Hosting.RemoteHost (1)
Aspire.Hosting.RemoteHost.Tests (2)
Aspire.Hosting.Tests (26)
Backchannel\AuxiliaryBackchannelTests.cs (16)
42var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
81var client1Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
82var client2Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
83var client3Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
132using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
166var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
201var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
244var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
286var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
366var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
407var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
444var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
493var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
535var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
578var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
622var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Utils\SocketPermissionHelperTests.cs (5)
32using var listener = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
52using var client = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
74using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
168using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
392using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Aspire.Hosting.TestUtilities (1)
Aspire.TerminalHost (3)
Aspire.TerminalHost.Tests (5)
TerminalHostAppTests.cs (5)
178rawSockets[i] = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
1028var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
1077var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
1204var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
1258using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
dotnet-svcutil-lib (2)
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (5)
Microsoft.Diagnostics.NETCore.Client (1)
Microsoft.DotNet.HotReload.Watch (1)
Microsoft.Extensions.Hosting.Systemd (1)
Microsoft.Extensions.ServiceDiscovery.Dns (2)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (3)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (2)
System.IO.Pipes (3)
System.Net.Http (1)
System.Net.HttpListener (1)
System.Net.NetworkInformation (1)
System.Net.Ping (2)
System.Net.Requests (4)
System.Net.Security (2)
System.Net.Sockets (14)
System.ServiceModel.NetTcp (1)
System.ServiceModel.UnixDomainSocket (1)
601 references to Socket
aspire (13)
aspire-managed (1)
Aspire.Cli.Tests (19)
Aspire.Dashboard.Tests (3)
Aspire.Hosting (28)
Aspire.Hosting.CodeGeneration.Go.Tests (1)
Aspire.Hosting.Native.Client (1)
Aspire.Hosting.Native.Core.Tests (9)
Aspire.Hosting.Native.Server (13)
Aspire.Hosting.RemoteHost (3)
Aspire.Hosting.RemoteHost.Tests (2)
Aspire.Hosting.Tests (32)
Backchannel\AuxiliaryBackchannelTests.cs (16)
42var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
81var client1Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
82var client2Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
83var client3Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
132using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
166var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
201var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
244var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
286var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
366var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
407var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
444var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
493var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
535var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
578var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
622var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Utils\SocketPermissionHelperTests.cs (6)
32using var listener = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
52using var client = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
54using var accepted = await listener.AcceptAsync(timeout.Token);
74using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
168using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
392using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
Aspire.Hosting.TestUtilities (1)
Aspire.TerminalHost (13)
Aspire.TerminalHost.Tests (11)
dotnet-svcutil-lib (4)
Microsoft.AspNetCore.Connections.Abstractions (1)
Microsoft.AspNetCore.InternalTesting (5)
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (22)
Microsoft.Diagnostics.NETCore.Client (12)
Microsoft.DotNet.HotReload.Watch (3)
Microsoft.Extensions.Hosting.Systemd (1)
Microsoft.Extensions.ServiceDiscovery.Dns (4)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (4)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (3)
Microsoft.TestPlatform.CommunicationUtilities (1)
netstandard (1)
System (1)
System.IO.Pipes (16)
System.Net (1)
System.Net.Http (2)
System.Net.HttpListener (5)
System.Net.NetworkInformation (10)
System.Net.Ping (5)
System.Net.Quic (1)
System.Net.Requests (13)
System.Net.Security (1)
System.Net.Sockets (320)
System\Net\Sockets\Socket.cs (128)
69private 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"/>.
178if (!Socket.OSSupportsUnixDomainSockets) throw new PlatformNotSupportedException();
212if (!Socket.OSSupportsUnixDomainSockets) throw new PlatformNotSupportedException();
839if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
883if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
908if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
939if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1006/// Places a <see cref="Socket"/> in a listening state.
1014/// Places a <see cref="Socket"/> in a listening state.
1034public Socket Accept()
1036if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1099Socket socket = CreateAcceptSocket(acceptedSocketHandle, remoteEndPoint);
1107if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1114if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1121if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1128if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1135if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1148if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1186if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1199if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1240if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1250if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1277if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1283/// Sends the file <paramref name="fileName"/> and buffers of data to a connected <see cref="Socket"/> object
1298/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception>
1299/// <exception cref="NotSupportedException">The <see cref="Socket"/> object is not connected to a remote host.</exception>
1300/// <exception cref="InvalidOperationException">The <see cref="Socket"/> object is not in blocking mode and cannot accept this synchronous call.</exception>
1305if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1311/// Sends the file <paramref name="fileName"/> and buffers of data to a connected <see cref="Socket"/> object
1326/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception>
1327/// <exception cref="NotSupportedException">The <see cref="Socket"/> object is not connected to a remote host.</exception>
1328/// <exception cref="InvalidOperationException">The <see cref="Socket"/> object is not in blocking mode and cannot accept this synchronous call.</exception>
1333if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1359if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1397if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1404if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1411if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1424/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1427if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1441/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1444if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1484/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1487if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1516if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1523if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1530if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1538if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1551if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1585if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1595if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1622if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1629if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1642if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1681if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1750/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception>
1753/// <see cref="Socket.ReceiveMessageFrom(Span{byte}, ref SocketFlags, ref EndPoint, out IPPacketInformation)"/>
1756/// <para>The <see cref="Socket"/> object is not in blocking mode and cannot accept this synchronous call.</para>
1760if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1822if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1903if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1910if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1917if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1930/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1945/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1948if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2028/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2031if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2176/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2179/// In general, the SetSocketOption method should be used whenever setting a <see cref="Socket"/> option.
2296/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2299/// In general, the GetSocketOption method should be used whenever getting a <see cref="Socket"/> option.
2342/// <summary>Determines the status of the <see cref="Socket"/>.</summary>
2346/// The status of the <see cref="Socket"/> based on the polling mode value passed in the <paramref name="mode"/> parameter.
2356/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2359if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2376/// <summary>Determines the status of the <see cref="Socket"/>.</summary>
2380/// The status of the <see cref="Socket"/> based on the polling mode value passed in the <paramref name="mode"/> parameter.
2391/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2396/// <param name="checkRead">An <see cref="IList"/> of <see cref="Socket"/> instances to check for readability.</param>
2397/// <param name="checkWrite">An <see cref="IList"/> of <see cref="Socket"/> instances to check for writability.</param>
2398/// <param name="checkError">An <see cref="IList"/> of <see cref="Socket"/> instances to check for errors.</param>
2406if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2438/// <param name="checkRead">An <see cref="IList"/> of <see cref="Socket"/> instances to check for readability.</param>
2439/// <param name="checkWrite">An <see cref="IList"/> of <see cref="Socket"/> instances to check for writability.</param>
2440/// <param name="checkError">An <see cref="IList"/> of <see cref="Socket"/> instances to check for errors.</param>
2506if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2516if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2534if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2543if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2565if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2572if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2590if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2604if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2613if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2631if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2639if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2661if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2679if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2702if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2722if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2742if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2761public Socket EndAccept(IAsyncResult asyncResult) => TaskToAsyncResult.End<Socket>(asyncResult);
2766private async Task<(Socket s, byte[] buffer, int bytesReceived)> AcceptAndReceiveHelperAsync(Socket? acceptSocket, int receiveSize)
2770Socket s = await AcceptAsync(acceptSocket).ConfigureAwait(false);
2799public IAsyncResult BeginAccept(Socket? acceptSocket, int receiveSize, AsyncCallback? callback, object? state) =>
2802public Socket EndAccept(out byte[] buffer, IAsyncResult asyncResult)
2804if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2806Socket socket = EndAccept(out byte[] innerBuffer, out int bytesTransferred, asyncResult);
2812public Socket EndAccept(out byte[] buffer, out int bytesTransferred, IAsyncResult asyncResult)
2814if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2816Socket s;
2817(s, buffer, bytesTransferred) = TaskToAsyncResult.End<(Socket, byte[], int)>(asyncResult);
3026Socket? attemptSocket = dnsEP.AddressFamily != AddressFamily.Unspecified ? new Socket(dnsEP.AddressFamily, socketType, protocolType) : null;
3041Socket attemptSocket = new Socket(endPointSnapshot.AddressFamily, socketType, protocolType);
3807internal Socket CreateAcceptSocket(SafeSocketHandle fd, EndPoint? remoteEP)
3811Socket socket = new Socket(fd, loadPropertiesFromHandle: false);
3815internal Socket UpdateAcceptSocket(Socket socket, EndPoint? remoteEP)
4079Socket socket = (Socket)socketList[i]!;
System\Net\Sockets\Socket.Tasks.cs (40)
32public Task<Socket> AcceptAsync() => AcceptAsync((Socket?)null, CancellationToken.None).AsTask();
39public ValueTask<Socket> AcceptAsync(CancellationToken cancellationToken) => AcceptAsync((Socket?)null, cancellationToken);
46public Task<Socket> AcceptAsync(Socket? acceptSocket) => AcceptAsync(acceptSocket, CancellationToken.None).AsTask();
54public ValueTask<Socket> AcceptAsync(Socket? acceptSocket, CancellationToken cancellationToken)
58return ValueTask.FromCanceled<Socket>(cancellationToken);
330saea.Completed += (s, e) => CompleteSendReceive((Socket)s!, (TaskSocketAsyncEventArgs<int>)e, isReceive: true);
594saea.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>
872private static void CompleteSendReceive(Socket s, TaskSocketAsyncEventArgs<int> saea, bool isReceive)
977internal sealed class AwaitableSocketAsyncEventArgs : SocketAsyncEventArgs, IValueTaskSource, IValueTaskSource<int>, IValueTaskSource<Socket>, IValueTaskSource<SocketReceiveFromResult>, IValueTaskSource<SocketReceiveMessageFromResult>
980private readonly Socket _owner;
989public AwaitableSocketAsyncEventArgs(Socket owner, bool isReceiveForCaching) :
1021public ValueTask<Socket> AcceptAsync(Socket socket, CancellationToken cancellationToken)
1026return new ValueTask<Socket>(this, _mrvtsc.Version);
1029Socket acceptSocket = AcceptSocket!;
1037new ValueTask<Socket>(acceptSocket) :
1038ValueTask.FromException<Socket>(CreateException(error));
1043public ValueTask<int> ReceiveAsync(Socket socket, CancellationToken cancellationToken)
1061public ValueTask<SocketReceiveFromResult> ReceiveFromAsync(Socket socket, CancellationToken cancellationToken)
1080internal ValueTask<int> ReceiveFromSocketAddressAsync(Socket socket, CancellationToken cancellationToken)
1098public ValueTask<SocketReceiveMessageFromResult> ReceiveMessageFromAsync(Socket socket, CancellationToken cancellationToken)
1121public ValueTask<int> SendAsync(Socket socket, CancellationToken cancellationToken)
1139public ValueTask SendAsyncForNetworkStream(Socket socket, CancellationToken cancellationToken)
1156public ValueTask SendPacketsAsync(Socket socket, CancellationToken cancellationToken)
1173public ValueTask<int> SendToAsync(Socket socket, CancellationToken cancellationToken)
1191public ValueTask ConnectAsync(Socket socket, CancellationToken cancellationToken)
1216public ValueTask DisconnectAsync(Socket socket, CancellationToken cancellationToken)
1285Socket IValueTaskSource<Socket>.GetResult(short token)
1293Socket acceptSocket = AcceptSocket!;
System\Net\Sockets\SocketAsyncEventArgs.cs (16)
17private Socket? _acceptSocket;
18private Socket? _connectSocket;
76private Socket? _currentSocket;
106public Socket? AcceptSocket
112public Socket? ConnectSocket
550internal void StartOperationCommon(Socket? socket, SocketAsyncOperation operation)
581_acceptAddressBufferCount = 2 * (Socket.GetAddressSize(_currentSocket!._rightEndPoint!) + 16);
639Socket? currentSocket = _currentSocket;
703Socket.OSSupportsIPv6 && Socket.OSSupportsIPv4;
742Socket? tempSocketIPv4 = null, tempSocketIPv6 = null;
751Socket? attemptSocket = null;
760(Socket.OSSupportsIPv6DualMode || !_currentSocket.TryReplaceHandleForAddressFamily(address.AddressFamily)))
773attemptSocket = tempSocketIPv6 ??= (Socket.OSSupportsIPv6 ? new Socket(AddressFamily.InterNetworkV6, socketType, protocolType) : null);
782attemptSocket = tempSocketIPv4 ??= (Socket.OSSupportsIPv4 ? new Socket(AddressFamily.InterNetwork, socketType, protocolType) : null);
955public void SetResults(Socket? socket, SocketError socketError, int bytesTransferred, SocketFlags flags, Exception? exception)
System\Net\Sockets\SocketAsyncEventArgs.Unix.cs (7)
46internal SocketError DoOperationAccept(Socket _ /*socket*/, SafeSocketHandle handle, SafeSocketHandle? acceptHandle, CancellationToken cancellationToken)
74internal SocketError DoOperationConnectEx(Socket _ /*socket*/, SafeSocketHandle handle, CancellationToken cancellationToken)
94internal SocketError DoOperationDisconnect(Socket socket, SafeSocketHandle handle, CancellationToken _ /*cancellationToken*/)
196internal SocketError DoOperationReceiveMessageFrom(Socket socket, SafeSocketHandle handle, CancellationToken cancellationToken)
203Socket.GetIPProtocolInformation(socket.AddressFamily, _socketAddress!, out isIPv4, out isIPv6);
244internal SocketError DoOperationSendPackets(Socket socket, SafeSocketHandle _1 /*handle*/, CancellationToken cancellationToken)
351Socket acceptedSocket = _currentSocket!.CreateAcceptSocket(
System\Net\Sockets\SocketPal.Unix.cs (29)
35public static void CheckDualModePacketInfoSupport(Socket socket)
1338public 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)
1343Socket.GetIPProtocolInformation(socket.AddressFamily, socketAddress, out isIPv4, out isIPv6);
1364public static SocketError ReceiveMessageFrom(Socket socket, SafeSocketHandle handle, Span<byte> buffer, ref SocketFlags socketFlags, SocketAddress socketAddress, out SocketAddress receiveAddress, out IPPacketInformation ipPacketInformation, out int bytesTransferred)
1369Socket.GetIPProtocolInformation(socket.AddressFamily, socketAddress, out isIPv4, out isIPv6);
1617public static void SetReceivingDualModeIPv4PacketInformation(Socket socket)
1628public static void SetIPProtectionLevel(Socket socket, SocketOptionLevel optionLevel, int protectionLevel)
1891Socket.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1892Socket.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1893Socket.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
1912Socket.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1913Socket.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1914Socket.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
1931Socket? socket = socketList[i] as Socket;
1934throw new ArgumentException(SR.Format(SR.net_sockets_select, socket?.GetType().FullName ?? "null", typeof(Socket).FullName), nameof(socketList));
1999Socket.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
2000Socket.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
2001Socket.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
2020Socket.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
2021Socket.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
2022Socket.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
2038Socket? socket = socketList[i] as Socket;
2041throw new ArgumentException(SR.Format(SR.net_sockets_select, socket?.GetType().FullName ?? "null", typeof(Socket).FullName), nameof(socketList));
2075Socket socket = (Socket)socketList[i]!;
2116Socket socket, TransmitFileOptions options, SendPacketsElement[] elements, SafeFileHandle[] fileHandles, CancellationToken cancellationToken, Action<long, SocketError> callback)
2191internal static SocketError Disconnect(Socket socket, SafeSocketHandle handle, bool reuseSocket)
System\Net\Sockets\SocketTaskExtensions.cs (22)
15public static Task<Socket> AcceptAsync(this Socket socket) =>
18public static Task<Socket> AcceptAsync(this Socket socket, Socket? acceptSocket) =>
22public static Task ConnectAsync(this Socket socket, EndPoint remoteEP) =>
25public static ValueTask ConnectAsync(this Socket socket, EndPoint remoteEP, CancellationToken cancellationToken) =>
28public static Task ConnectAsync(this Socket socket, IPAddress address, int port) =>
31public static ValueTask ConnectAsync(this Socket socket, IPAddress address, int port, CancellationToken cancellationToken) =>
34public static Task ConnectAsync(this Socket socket, IPAddress[] addresses, int port) =>
37public static ValueTask ConnectAsync(this Socket socket, IPAddress[] addresses, int port, CancellationToken cancellationToken) =>
40public static Task ConnectAsync(this Socket socket, string host, int port) =>
43public static ValueTask ConnectAsync(this Socket socket, string host, int port, CancellationToken cancellationToken) =>
47public static Task<int> ReceiveAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags) =>
50public static ValueTask<int> ReceiveAsync(this Socket socket, Memory<byte> buffer, SocketFlags socketFlags, CancellationToken cancellationToken = default) =>
53public static Task<int> ReceiveAsync(this Socket socket, IList<ArraySegment<byte>> buffers, SocketFlags socketFlags) =>
56public static Task<SocketReceiveFromResult> ReceiveFromAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags, EndPoint remoteEndPoint) =>
59public static Task<SocketReceiveMessageFromResult> ReceiveMessageFromAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags, EndPoint remoteEndPoint) =>
63public static Task<int> SendAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags) =>
66public static ValueTask<int> SendAsync(this Socket socket, ReadOnlyMemory<byte> buffer, SocketFlags socketFlags, CancellationToken cancellationToken = default) =>
69public static Task<int> SendAsync(this Socket socket, IList<ArraySegment<byte>> buffers, SocketFlags socketFlags) =>
73public static Task<int> SendToAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags, EndPoint remoteEP) =>
System.ServiceModel.NetTcp (6)
System.ServiceModel.UnixDomainSocket (5)