59 instantiations of SocketException
ClientSample (1)
Tcp\SocketAwaitable.cs (1)
42throw new SocketException((int)_error);
dotnet-svcutil-lib (2)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (2)
486throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SocketException((int)_asyncWriteEventArgs.SocketError)); 725throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SocketException((int)_asyncReadEventArgs.SocketError));
Microsoft.AspNetCore.InternalTesting (1)
HttpClientSlim.cs (1)
191throw new SocketException((int)socketArgs.SocketError, $"Failed to connect to server {requestUri.Host} on port {requestUri.Port}");
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Internal\SocketAwaitableEventArgs.cs (1)
61return new SocketException((int)e);
Sockets.BindTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\HostNameIsReachableAttribute.cs (1)
80throw new SocketException((int)socketArgs.SocketError);
Sockets.FunctionalTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\HostNameIsReachableAttribute.cs (1)
80throw new SocketException((int)socketArgs.SocketError);
System.Net.NameResolution (1)
System\Net\Dns.cs (1)
741new SocketException((int)error) { HResult = nativeError };
System.Net.Ping (1)
src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
29throw new SocketException((int)SocketError.AddressFamilyNotSupported);
System.Net.Primitives (3)
src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
29throw new SocketException((int)SocketError.AddressFamilyNotSupported);
System\Net\IPAddress.cs (1)
761private static void ThrowSocketOperationNotSupported() => throw new SocketException(SocketError.OperationNotSupported);
System\Net\IPAddressParser.cs (1)
45throw new FormatException(SR.dns_bad_ip_address, new SocketException(SocketError.InvalidArgument));
System.Net.Quic (6)
src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
29throw new SocketException((int)SocketError.AddressFamilyNotSupported);
System\Net\Quic\Internal\ThrowHelper.cs (4)
83if (status == QUIC_STATUS_INVALID_ADDRESS) return new SocketException((int)SocketError.AddressNotAvailable); 84if (status == QUIC_STATUS_ADDRESS_IN_USE) return new SocketException((int)SocketError.AddressAlreadyInUse); 85if (status == QUIC_STATUS_UNREACHABLE) return new SocketException((int)SocketError.HostUnreachable); 86if (status == QUIC_STATUS_ADDRESS_NOT_AVAILABLE) return new SocketException((int)SocketError.AddressFamilyNotSupported);
System\Net\Quic\QuicConnection.cs (1)
400throw new SocketException((int)SocketError.HostNotFound);
System.Net.Sockets (40)
src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
29throw new SocketException((int)SocketError.AddressFamilyNotSupported);
src\libraries\Common\src\System\Net\Sockets\SocketExceptionFactory.Unix.cs (1)
18return new SocketException(socketError, CreateMessage(nativeErr, endPoint));
System\Net\Sockets\Socket.cs (19)
92throw new SocketException((int)errorCode); 1134throw new SocketException((int)errorCode); 1163if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1185throw new SocketException((int)errorCode); 1211if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1238throw new SocketException((int)errorCode); 1256if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1530throw new SocketException((int)errorCode); 1553if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1576throw new SocketException((int)errorCode); 1594if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1621throw new SocketException((int)errorCode); 1651if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1835socketException = new SocketException((int)errorCode); 1959socketException = new SocketException((int)errorCode); 2035SocketException socketException = new SocketException((int)errorCode); 2419throw new SocketException((int)errorCode); 3911var socketException = new SocketException((int)error); 4037throw new SocketException((int)SocketError.IsConnected);
System\Net\Sockets\Socket.Tasks.cs (3)
184throw new SocketException((int)SocketError.IsConnected); 925Exception e = ExceptionDispatchInfo.SetCurrentStackTrace(new SocketException((int)error)); 1391Exception e = new SocketException((int)error);
System\Net\Sockets\Socket.Unix.cs (4)
71throw new SocketException((int)SocketError.NotSocket); 79throw new SocketException((int)SocketError.NotSocket); 125throw new SocketException((int)errorCode); 199throw new SocketException((int)SocketError.InvalidArgument);
System\Net\Sockets\SocketAsyncContext.Unix.cs (1)
1358throw new SocketException((int)SocketPal.GetSocketErrorForErrorCode(Interop.Sys.GetLastError()));
System\Net\Sockets\SocketAsyncEventArgs.cs (3)
792throw new SocketException((int)SocketError.OperationAborted); 799caughtException = new SocketException((int)lastError); 804caughtException = new SocketException((int)SocketError.OperationAborted);
System\Net\Sockets\SocketPal.Unix.cs (4)
2123throw new SocketException((int)error); 2134throw new SocketException((int)error); 2180throw new SocketException((int)GetSocketErrorForErrorCode(err)); 2194throw new SocketException((int)errorCode);
System\Net\Sockets\UDPClient.cs (4)
427throw new SocketException((int)SocketError.OperationNotSupported); 447throw new SocketException((int)SocketError.OperationNotSupported); 515throw new SocketException((int)SocketError.OperationNotSupported); 795throw new SocketException((int)SocketError.NotConnected);
System.ServiceModel.UnixDomainSocket (1)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (1)
103return new SocketException((int)e);
156 references to SocketException
Aspire.RabbitMQ.Client (1)
AspireRabbitMQExtensions.cs (1)
171ShouldHandle = static args => args.Outcome is { Exception: SocketException or BrokerUnreachableException }
ClientSample (3)
Tcp\TcpConnection.cs (3)
116catch (SocketException ex) when (ex.SocketErrorCode == SocketError.ConnectionReset) 120catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted || 191catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted)
dotnet-svcutil-lib (21)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (7)
348catch (SocketException socketException) 400catch (SocketException socketException) 462catch (SocketException socketException) 543catch (SocketException socketException) 586catch (SocketException socketException) 662catch (SocketException socketException) 702catch (SocketException socketException)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\DnsCache.cs (3)
63catch (SocketException) 105SocketException dnsException = null; 110catch (SocketException e)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SocketConnection.cs (11)
170protected Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime) 176protected Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime) 182internal static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException) 204private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException, 435public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException) 497catch (SocketException socketException) 513SocketException innerException) 540SocketException lastException = null; 564catch (SocketException socketException) 592SocketException lastException = null; 616catch (SocketException socketException)
HttpStress (1)
Program.cs (1)
597if (e is HttpRequestException hre && hre.InnerException is SocketException se && se.SocketErrorCode == SocketError.AddressAlreadyInUse)
IIS.LongTests (3)
src\Servers\IIS\IIS\test\Common.LongTests\ShutdownTests.cs (2)
438catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 594catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1457catch (SocketException)
IIS.NewHandler.FunctionalTests (3)
src\Servers\IIS\IIS\test\Common.LongTests\ShutdownTests.cs (2)
438catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 594catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1457catch (SocketException)
IIS.NewShim.FunctionalTests (3)
src\Servers\IIS\IIS\test\Common.LongTests\ShutdownTests.cs (2)
438catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 594catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1457catch (SocketException)
IISExpress.FunctionalTests (4)
InProcess\IISExpressShutdownTests.cs (1)
65catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException)
src\Servers\IIS\IIS\test\Common.LongTests\ShutdownTests.cs (2)
438catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 594catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1457catch (SocketException)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
368if (_options.UseForceReconnect && (exception is RedisConnectionException or SocketException))
Microsoft.AspNetCore.Server.IntegrationTesting (1)
Common\TestPortHelper.cs (1)
47catch (SocketException)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
Internal\QuicConnectionListener.cs (1)
134catch (SocketException e) when (e.SocketErrorCode == SocketError.AddressAlreadyInUse)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (8)
Internal\SocketAwaitableEventArgs.cs (1)
59protected static SocketException CreateException(SocketError e)
Internal\SocketConnection.cs (2)
211var ex = result.SocketError; 291var ex = transferResult.SocketError;
Internal\SocketOperationResult.cs (2)
11public readonly SocketException? SocketError; 24public SocketOperationResult(SocketException exception)
SocketConnectionListener.cs (3)
46catch (SocketException e) when (e.SocketErrorCode == SocketError.AddressAlreadyInUse) 82catch (SocketException e) when (e.SocketErrorCode == SocketError.OperationAborted) 87catch (SocketException)
Microsoft.DotNet.Helix.Client (1)
HelixApi.cs (1)
24exception is SocketException ||
Microsoft.DotNet.Helix.Sdk (1)
AzureDevOpsTask.cs (1)
188ex is SocketException
Microsoft.Extensions.Caching.StackExchangeRedis (1)
RedisCache.cs (1)
628if (_options.UseForceReconnect && (exception is RedisConnectionException or SocketException))
Microsoft.Extensions.Diagnostics.ExceptionSummarization (3)
ExceptionSummarizationBuilderExtensions.cs (1)
17/// Registers a summary provider that handles <see cref="OperationCanceledException"/>, <see cref="WebException"/>, and <see cref="SocketException"/> .
HttpExceptionSummaryProvider.cs (2)
77typeof(SocketException), 104case SocketException ex:
Microsoft.Extensions.Diagnostics.Probes (1)
TcpEndpointProbesService.cs (1)
57catch (SocketException ex)
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
TcpEndpointProbesServiceTests.cs (1)
107catch (SocketException e)
netstandard (1)
netstandard.cs (1)
1272[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.SocketException))]
Sockets.BindTests (6)
src\Servers\Kestrel\shared\test\TransportTestHelpers\HostNameIsReachableAttribute.cs (1)
47catch (SocketException ex) when (
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6ScopeIdPresentConditionAttribute.cs (1)
29catch (SocketException)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6SupportedConditionAttribute.cs (1)
30catch (SocketException)
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (3)
955catch (SocketException) 1240catch (SocketException) 1257catch (SocketException)
Sockets.FunctionalTests (4)
src\Servers\Kestrel\shared\test\TransportTestHelpers\HostNameIsReachableAttribute.cs (1)
47catch (SocketException ex) when (
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6ScopeIdPresentConditionAttribute.cs (1)
29catch (SocketException)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6SupportedConditionAttribute.cs (1)
30catch (SocketException)
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (1)
720Assert.Throws<SocketException>(() => socket.Receive(new byte[32]));
System (1)
src\libraries\shims\System\ref\System.cs (1)
762[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.SocketException))]
System.IO.Pipes (7)
System\IO\Pipes\NamedPipeClientStream.Unix.cs (1)
46catch (SocketException e)
System\IO\Pipes\NamedPipeServerStream.Unix.cs (1)
333catch (SocketException) when (isFirstPipeInstance && !isSocketBound)
System\IO\Pipes\PipeStream.Unix.cs (5)
274catch (SocketException e) 297catch (SocketException e) 309catch (SocketException e) 326catch (SocketException e) 332private IOException GetIOExceptionForSocketException(SocketException e)
System.Net (1)
System.Net.cs (1)
43[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.SocketException))]
System.Net.Http (2)
System\Net\Http\SocketsHttpHandler\ConnectHelper.cs (1)
156if (exception is SocketException socketException &&
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (1)
153catch (Exception e) when (e is SocketException || e is ObjectDisposedException)
System.Net.HttpListener (3)
System\Net\Managed\HttpEndPointManager.cs (1)
159catch (SocketException ex)
System\Net\ServiceNameStore.cs (2)
284catch (System.Net.Sockets.SocketException) 302catch (System.Net.Sockets.SocketException)
System.Net.NameResolution (5)
System\Net\Dns.cs (4)
134if (ex is SocketException soex) 330catch (SocketException ex) 360catch (SocketException ex) 740private static SocketException CreateException(SocketError error, int nativeError) =>
System\Net\NameResolutionTelemetry.cs (1)
145internal static string GetErrorType(Exception exception) => (exception as SocketException)?.SocketErrorCode switch
System.Net.NetworkInformation (1)
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (1)
206catch (SocketException se) when (se.SocketErrorCode == SocketError.OperationAborted)
System.Net.Ping (6)
System\Net\NetworkInformation\Ping.RawSocket.cs (6)
281catch (SocketException ex) when (ex.SocketErrorCode == SocketError.TimedOut) 284catch (SocketException ex) when (ex.SocketErrorCode == SocketError.MessageSize) 288catch (SocketException ex) when (ex.SocketErrorCode == SocketError.HostUnreachable) 366catch (SocketException ex) when (ex.SocketErrorCode == SocketError.TimedOut) 369catch (SocketException ex) when (ex.SocketErrorCode == SocketError.MessageSize) 376catch (SocketException ex) when (ex.SocketErrorCode == SocketError.HostUnreachable)
System.Net.Primitives (5)
System\Net\SocketException.cs (4)
18/// <summary>Creates a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the specified error code.</summary> 33/// <summary>Initializes a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the specified error code and optional message.</summary> 38/// <summary>Creates a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the specified error code as SocketError.</summary> 44/// <summary>Initializes a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the specified error code as SocketError and optional message.</summary>
System\Net\SocketException.Unix.cs (1)
10/// <summary>Creates a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the default error code.</summary>
System.Net.Requests (5)
System\Net\FtpWebRequest.cs (3)
919ioEx.InnerException is SocketException sEx && 937if (e is SocketException se) 1007if (!(exception is SocketException || exception is ObjectDisposedException) || !timer.HasExpired)
System\Net\WebException.cs (2)
105SocketException? socketException = ex.InnerException as SocketException;
System.Net.Sockets (40)
src\libraries\Common\src\System\Net\Sockets\SocketExceptionFactory.Unix.cs (1)
8public static SocketException CreateSocketException(int socketError, EndPoint endPoint)
System\Net\Sockets\Socket.cs (22)
107/// <exception cref="SocketException"><paramref name="handle"/> is not a socket or information about the socket could not be accessed.</exception> 1295/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1323/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1409/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1426/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1469/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1832SocketException? socketException = null; 1915/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1930/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1956SocketException? socketException = null; 2013/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2035SocketException socketException = new SocketException((int)errorCode); 2163/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2283/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2341/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2376/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2388/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2431/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 3370SocketException socketException = SocketExceptionFactory.CreateSocketException((int)errorCode, endPointSnapshot); 3911var socketException = new SocketException((int)error); 3920internal void UpdateStatusAfterSocketError(SocketException socketException, bool disconnectOnFailure = true) 4070SocketException se => se.SocketErrorCode,
System\Net\Sockets\Socket.Tasks.cs (3)
121catch (SocketException se) when (se.SocketErrorCode == SocketError.OperationAborted) 732/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 750/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception>
System\Net\Sockets\Socket.Unix.cs (1)
306catch (TargetInvocationException ex) when (ex.InnerException is SocketException se && se.SocketErrorCode == SocketError.OperationNotSupported)
System\Net\Sockets\SocketAsyncEventArgs.cs (3)
451SocketException? socketException = exception as SocketException; 827(caughtException is SocketException se && se.SocketErrorCode == SocketError.OperationAborted))
System\Net\Sockets\SocketPal.Unix.cs (1)
2146exc is SocketException se ? se.SocketErrorCode :
System\Net\Sockets\TCPListener.cs (2)
152catch (SocketException) 299catch (SocketException) when (!_active)
System\Net\Sockets\UDPClient.cs (7)
538/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 563/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 597/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 640/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 889/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 930/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 959/// <exception cref="SocketException">An error occurred when accessing the socket.</exception>
System.ServiceModel.UnixDomainSocket (11)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (1)
101protected static SocketException CreateException(SocketError e)
System\ServiceModel\Channels\SocketConnection.cs (10)
201catch (SocketException socketException) 280catch (SocketException socketException) 389catch (SocketException socketException) 633private Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout) 639private Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout) 645private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException, 790public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException) 837private static TimeoutException CreateTimeoutException(Uri uri, TimeSpan timeout, SocketException innerException) 845SocketException lastException = null; 858catch (SocketException socketException)