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