113 instantiations of Socket
aspire (5)
Aspire.Hosting (3)
Aspire.Hosting.RemoteHost (1)
Aspire.Hosting.Tests (13)
Backchannel\AuxiliaryBackchannelTests.cs (11)
45var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
87var client1Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
88var client2Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
89var client3Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
132var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
170var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
216var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
261var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
344var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
388var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
428var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
ClientSample (1)
dotnet-svcutil-lib (2)
IIS.Common.TestLib (1)
IIS.FunctionalTests (1)
IIS.LongTests (1)
IIS.NewHandler.FunctionalTests (1)
IIS.NewShim.FunctionalTests (1)
IISExpress.FunctionalTests (2)
InMemory.FunctionalTests (3)
Interop.FunctionalTests (1)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (10)
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (5)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
Microsoft.Extensions.Hosting.Systemd (1)
Microsoft.Extensions.ServiceDiscovery.Dns (2)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (3)
Sockets.BindTests (10)
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (7)
538using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
573using (var socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
940using (var socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
948using (var socket = new Socket(addressFamily, SocketType.Stream, ProtocolType.Tcp))
1195using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
1211using (var serverSocket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
1250using (var socket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
Sockets.FunctionalTests (10)
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.Sockets (14)
System.ServiceModel.NetTcp (1)
System.ServiceModel.UnixDomainSocket (1)
575 references to Socket
aspire (5)
Aspire.Hosting (14)
Aspire.Hosting.RemoteHost (2)
Aspire.Hosting.Tests (13)
Backchannel\AuxiliaryBackchannelTests.cs (11)
45var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
87var client1Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
88var client2Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
89var client3Socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
132var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
170var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
216var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
261var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
344var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
388var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
428var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
ClientSample (5)
dotnet-svcutil-lib (4)
IIS.Common.TestLib (6)
IIS.FunctionalTests (1)
IIS.LongTests (1)
IIS.NewHandler.FunctionalTests (1)
IIS.NewShim.FunctionalTests (1)
IISExpress.FunctionalTests (2)
InMemory.FunctionalTests (10)
Interop.FunctionalTests (1)
Microsoft.AspNetCore.Connections.Abstractions (1)
Microsoft.AspNetCore.InternalTesting (5)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (10)
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (11)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (22)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (3)
Microsoft.Extensions.Hosting.Systemd (1)
Microsoft.Extensions.ServiceDiscovery.Dns (8)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (4)
netstandard (1)
Sockets.BindTests (27)
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (8)
538using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
573using (var socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
940using (var socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
948using (var socket = new Socket(addressFamily, SocketType.Stream, ProtocolType.Tcp))
1195using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
1211using (var serverSocket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
1229if (Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, socketArgs))
1250using (var socket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
Sockets.FunctionalTests (24)
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.Sockets (317)
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"/>.
172if (!Socket.OSSupportsUnixDomainSockets) throw new PlatformNotSupportedException();
206if (!Socket.OSSupportsUnixDomainSockets) throw new PlatformNotSupportedException();
832if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
876if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
901if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
932if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
999/// Places a <see cref="Socket"/> in a listening state.
1007/// Places a <see cref="Socket"/> in a listening state.
1027public Socket Accept()
1029if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1090Socket socket = CreateAcceptSocket(acceptedSocketHandle, _rightEndPoint.Create(socketAddress));
1098if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1105if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1112if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1119if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1126if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1139if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1177if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1190if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1231if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1241if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1268if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1274/// Sends the file <paramref name="fileName"/> and buffers of data to a connected <see cref="Socket"/> object
1289/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception>
1290/// <exception cref="NotSupportedException">The <see cref="Socket"/> object is not connected to a remote host.</exception>
1291/// <exception cref="InvalidOperationException">The <see cref="Socket"/> object is not in blocking mode and cannot accept this synchronous call.</exception>
1296if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1302/// Sends the file <paramref name="fileName"/> and buffers of data to a connected <see cref="Socket"/> object
1317/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception>
1318/// <exception cref="NotSupportedException">The <see cref="Socket"/> object is not connected to a remote host.</exception>
1319/// <exception cref="InvalidOperationException">The <see cref="Socket"/> object is not in blocking mode and cannot accept this synchronous call.</exception>
1324if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1350if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1388if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1395if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1402if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1415/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1418if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1432/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1435if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1475/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1478if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1507if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1514if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1521if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1529if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1542if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1576if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1586if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1613if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1620if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1633if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1672if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1741/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception>
1744/// <see cref="Socket.ReceiveMessageFrom(Span{byte}, ref SocketFlags, ref EndPoint, out IPPacketInformation)"/>
1747/// <para>The <see cref="Socket"/> object is not in blocking mode and cannot accept this synchronous call.</para>
1751if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1813if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1894if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1901if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1908if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
1921/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1936/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
1939if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2019/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2022if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2167/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2170/// In general, the SetSocketOption method should be used whenever setting a <see cref="Socket"/> option.
2287/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2290/// In general, the GetSocketOption method should be used whenever getting a <see cref="Socket"/> option.
2333/// <summary>Determines the status of the <see cref="Socket"/>.</summary>
2337/// The status of the <see cref="Socket"/> based on the polling mode value passed in the <paramref name="mode"/> parameter.
2347/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2350if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2367/// <summary>Determines the status of the <see cref="Socket"/>.</summary>
2371/// The status of the <see cref="Socket"/> based on the polling mode value passed in the <paramref name="mode"/> parameter.
2382/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> has been closed.</exception>
2387/// <param name="checkRead">An <see cref="IList"/> of <see cref="Socket"/> instances to check for readability.</param>
2388/// <param name="checkWrite">An <see cref="IList"/> of <see cref="Socket"/> instances to check for writability.</param>
2389/// <param name="checkError">An <see cref="IList"/> of <see cref="Socket"/> instances to check for errors.</param>
2397if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2429/// <param name="checkRead">An <see cref="IList"/> of <see cref="Socket"/> instances to check for readability.</param>
2430/// <param name="checkWrite">An <see cref="IList"/> of <see cref="Socket"/> instances to check for writability.</param>
2431/// <param name="checkError">An <see cref="IList"/> of <see cref="Socket"/> instances to check for errors.</param>
2497if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2507if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2525if (!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
2556if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2563if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2581if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2595if (!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
2622if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2630if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2652if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2670if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2693if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2713if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2733if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2752public Socket EndAccept(IAsyncResult asyncResult) => TaskToAsyncResult.End<Socket>(asyncResult);
2757private async Task<(Socket s, byte[] buffer, int bytesReceived)> AcceptAndReceiveHelperAsync(Socket? acceptSocket, int receiveSize)
2761Socket s = await AcceptAsync(acceptSocket).ConfigureAwait(false);
2790public IAsyncResult BeginAccept(Socket? acceptSocket, int receiveSize, AsyncCallback? callback, object? state) =>
2793public Socket EndAccept(out byte[] buffer, IAsyncResult asyncResult)
2795if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2797Socket socket = EndAccept(out byte[] innerBuffer, out int bytesTransferred, asyncResult);
2803public Socket EndAccept(out byte[] buffer, out int bytesTransferred, IAsyncResult asyncResult)
2805if (!Socket.OSSupportsThreads) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
2807Socket s;
2808(s, buffer, bytesTransferred) = TaskToAsyncResult.End<(Socket, byte[], int)>(asyncResult);
3010Socket? attemptSocket = dnsEP.AddressFamily != AddressFamily.Unspecified ? new Socket(dnsEP.AddressFamily, socketType, protocolType) : null;
3025Socket attemptSocket = new Socket(endPointSnapshot.AddressFamily, socketType, protocolType);
3786internal Socket CreateAcceptSocket(SafeSocketHandle fd, EndPoint? remoteEP)
3790Socket socket = new Socket(fd, loadPropertiesFromHandle: false);
3794internal Socket UpdateAcceptSocket(Socket socket, EndPoint? remoteEP)
4058Socket 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);
326saea.Completed += (s, e) => CompleteSendReceive((Socket)s!, (TaskSocketAsyncEventArgs<int>)e, isReceive: true);
590saea.Completed += (s, e) => CompleteSendReceive((Socket)s!, (TaskSocketAsyncEventArgs<int>)e, isReceive: false);
699/// Sends the file <paramref name="fileName"/> to a connected <see cref="Socket"/> object.
703/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception>
704/// <exception cref="NotSupportedException">The <see cref="Socket"/> object is not connected to a remote host.</exception>
713/// Sends the file <paramref name="fileName"/> and buffers of data to a connected <see cref="Socket"/> object
721/// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception>
722/// <exception cref="NotSupportedException">The <see cref="Socket"/> object is not connected to a remote host.</exception>
868private static void CompleteSendReceive(Socket s, TaskSocketAsyncEventArgs<int> saea, bool isReceive)
973internal sealed class AwaitableSocketAsyncEventArgs : SocketAsyncEventArgs, IValueTaskSource, IValueTaskSource<int>, IValueTaskSource<Socket>, IValueTaskSource<SocketReceiveFromResult>, IValueTaskSource<SocketReceiveMessageFromResult>
976private readonly Socket _owner;
985public AwaitableSocketAsyncEventArgs(Socket owner, bool isReceiveForCaching) :
1017public ValueTask<Socket> AcceptAsync(Socket socket, CancellationToken cancellationToken)
1022return new ValueTask<Socket>(this, _mrvtsc.Version);
1025Socket acceptSocket = AcceptSocket!;
1033new ValueTask<Socket>(acceptSocket) :
1034ValueTask.FromException<Socket>(CreateException(error));
1039public ValueTask<int> ReceiveAsync(Socket socket, CancellationToken cancellationToken)
1057public ValueTask<SocketReceiveFromResult> ReceiveFromAsync(Socket socket, CancellationToken cancellationToken)
1076internal ValueTask<int> ReceiveFromSocketAddressAsync(Socket socket, CancellationToken cancellationToken)
1094public ValueTask<SocketReceiveMessageFromResult> ReceiveMessageFromAsync(Socket socket, CancellationToken cancellationToken)
1117public ValueTask<int> SendAsync(Socket socket, CancellationToken cancellationToken)
1135public ValueTask SendAsyncForNetworkStream(Socket socket, CancellationToken cancellationToken)
1152public ValueTask SendPacketsAsync(Socket socket, CancellationToken cancellationToken)
1169public ValueTask<int> SendToAsync(Socket socket, CancellationToken cancellationToken)
1187public ValueTask ConnectAsync(Socket socket, CancellationToken cancellationToken)
1212public ValueTask DisconnectAsync(Socket socket, CancellationToken cancellationToken)
1281Socket IValueTaskSource<Socket>.GetResult(short token)
1289Socket acceptSocket = AcceptSocket!;
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)
1304public 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)
1309Socket.GetIPProtocolInformation(socket.AddressFamily, socketAddress, out isIPv4, out isIPv6);
1330public static SocketError ReceiveMessageFrom(Socket socket, SafeSocketHandle handle, Span<byte> buffer, ref SocketFlags socketFlags, SocketAddress socketAddress, out SocketAddress receiveAddress, out IPPacketInformation ipPacketInformation, out int bytesTransferred)
1335Socket.GetIPProtocolInformation(socket.AddressFamily, socketAddress, out isIPv4, out isIPv6);
1583public static void SetReceivingDualModeIPv4PacketInformation(Socket socket)
1594public static void SetIPProtectionLevel(Socket socket, SocketOptionLevel optionLevel, int protectionLevel)
1857Socket.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1858Socket.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1859Socket.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
1878Socket.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1879Socket.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1880Socket.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
1897Socket? socket = socketList[i] as Socket;
1900throw new ArgumentException(SR.Format(SR.net_sockets_select, socket?.GetType().FullName ?? "null", typeof(Socket).FullName), nameof(socketList));
1965Socket.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1966Socket.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1967Socket.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
1986Socket.SocketListDangerousReleaseRefs(checkRead, ref refsAdded);
1987Socket.SocketListDangerousReleaseRefs(checkWrite, ref refsAdded);
1988Socket.SocketListDangerousReleaseRefs(checkError, ref refsAdded);
2004Socket? socket = socketList[i] as Socket;
2007throw new ArgumentException(SR.Format(SR.net_sockets_select, socket?.GetType().FullName ?? "null", typeof(Socket).FullName), nameof(socketList));
2041Socket socket = (Socket)socketList[i]!;
2082Socket socket, TransmitFileOptions options, SendPacketsElement[] elements, SafeFileHandle[] fileHandles, CancellationToken cancellationToken, Action<long, SocketError> callback)
2157internal 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)
VBCSCompiler.UnitTests (5)