83 references to SocketErrorCode
ClientSample (6)
Tcp\TcpConnection.cs (6)
116catch (SocketException ex) when (ex.SocketErrorCode == SocketError.ConnectionReset) 120catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted || 121ex.SocketErrorCode == SocketError.ConnectionAborted || 122ex.SocketErrorCode == SocketError.Interrupted || 123ex.SocketErrorCode == SocketError.InvalidArgument) 191catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted)
dotnet-svcutil-lib (24)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SocketConnection.cs (24)
208if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_INVALID_HANDLE) 219if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAECONNABORTED && 226if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAENETRESET || 227(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAECONNABORTED || 228(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAECONNRESET) 240else if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAETIMEDOUT) 249return new CommunicationObjectAbortedException(string.Format(SRServiceModel.TcpTransferError, (int)socketException.SocketErrorCode, socketException.Message), originalException); 253CommunicationException communicationException = new CommunicationException(string.Format(SRServiceModel.TcpTransferError, (int)socketException.SocketErrorCode, socketException.Message), originalException); 437if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_INVALID_HANDLE) 442if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAEADDRNOTAVAIL || 443(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAECONNREFUSED || 444(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAENETDOWN || 445(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAENETUNREACH || 446(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAEHOSTDOWN || 447(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAEHOSTUNREACH || 448(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAETIMEDOUT) 452return new EndpointNotFoundException(string.Format(SRServiceModel.TcpConnectError, remoteUri.AbsoluteUri, (int)socketException.SocketErrorCode, socketException.Message), innerException); 456return new EndpointNotFoundException(string.Format(SRServiceModel.TcpConnectErrorWithTimeSpan, remoteUri.AbsoluteUri, (int)socketException.SocketErrorCode, socketException.Message, timeSpent), innerException); 459else if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAENOBUFS) 463else if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_NOT_ENOUGH_MEMORY || 464(int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_NO_SYSTEM_RESOURCES || 465(int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_OUTOFMEMORY) 473return new CommunicationException(string.Format(SRServiceModel.TcpConnectError, remoteUri.AbsoluteUri, (int)socketException.SocketErrorCode, socketException.Message), innerException); 477return new CommunicationException(string.Format(SRServiceModel.TcpConnectErrorWithTimeSpan, remoteUri.AbsoluteUri, (int)socketException.SocketErrorCode, socketException.Message, timeSpent), innerException);
HttpStress (1)
Program.cs (1)
597if (e is HttpRequestException hre && hre.InnerException is SocketException se && se.SocketErrorCode == SocketError.AddressAlreadyInUse)
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 (6)
Internal\SocketConnection.cs (4)
209if (IsConnectionResetError(result.SocketError.SocketErrorCode)) 219if (IsConnectionAbortError(result.SocketError.SocketErrorCode)) 289if (IsConnectionResetError(transferResult.SocketError.SocketErrorCode)) 298if (IsConnectionAbortError(transferResult.SocketError.SocketErrorCode))
SocketConnectionListener.cs (2)
46catch (SocketException e) when (e.SocketErrorCode == SocketError.AddressAlreadyInUse) 82catch (SocketException e) when (e.SocketErrorCode == SocketError.OperationAborted)
Microsoft.Extensions.Diagnostics.ExceptionSummarization (1)
HttpExceptionSummaryProvider.cs (1)
106if (_socketErrorMap.TryGetValue(ex.SocketErrorCode, out var index))
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
TcpEndpointProbesServiceTests.cs (1)
109if (e.SocketErrorCode == SocketError.ConnectionRefused)
Sockets.BindTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\HostNameIsReachableAttribute.cs (2)
48ex.SocketErrorCode == SocketError.NetworkUnreachable 49|| ex.SocketErrorCode == SocketError.HostNotFound)
Sockets.FunctionalTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\HostNameIsReachableAttribute.cs (2)
48ex.SocketErrorCode == SocketError.NetworkUnreachable 49|| ex.SocketErrorCode == SocketError.HostNotFound)
System.IO.Pipes (2)
System\IO\Pipes\NamedPipeClientStream.Unix.cs (1)
51switch (e.SocketErrorCode)
System\IO\Pipes\PipeStream.Unix.cs (1)
334if (e.SocketErrorCode == SocketError.Shutdown) // EPIPE
System.Net.Http (1)
System\Net\Http\SocketsHttpHandler\ConnectHelper.cs (1)
157socketException.SocketErrorCode is SocketError.HostNotFound or SocketError.TryAgain)
System.Net.NameResolution (1)
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.Requests (3)
System\Net\FtpWebRequest.cs (2)
920sEx.SocketErrorCode == SocketError.TimedOut) 939if (se.SocketErrorCode == SocketError.HostNotFound)
System\Net\WebException.cs (1)
113switch (socketException.SocketErrorCode)
System.Net.Sockets (9)
System\Net\Sockets\Socket.cs (4)
1839if (socketException.SocketErrorCode != SocketError.MessageSize) 1963if (socketException.SocketErrorCode != SocketError.MessageSize) 3922UpdateStatusAfterSocketError(socketException.SocketErrorCode, disconnectOnFailure); 4070SocketException se => se.SocketErrorCode,
System\Net\Sockets\Socket.Tasks.cs (1)
121catch (SocketException se) when (se.SocketErrorCode == SocketError.OperationAborted)
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 (2)
454_socketError = socketException.SocketErrorCode; 827(caughtException is SocketException se && se.SocketErrorCode == SocketError.OperationAborted))
System\Net\Sockets\SocketPal.Unix.cs (1)
2146exc is SocketException se ? se.SocketErrorCode :
System.ServiceModel.UnixDomainSocket (16)
System\ServiceModel\Channels\SocketConnection.cs (16)
792if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_INVALID_HANDLE) 797if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAEADDRNOTAVAIL || 798(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAECONNREFUSED || 799(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAENETDOWN || 800(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAENETUNREACH || 801(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAEHOSTDOWN || 802(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAEHOSTUNREACH || 803(int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAETIMEDOUT) 807return new EndpointNotFoundException(SR.Format(SR.UDSConnectError, remoteUri.AbsoluteUri, (int)socketException.SocketErrorCode, socketException.Message), innerException); 811return new EndpointNotFoundException(SR.Format(SR.UDSConnectErrorWithTimeSpan, remoteUri.AbsoluteUri, (int)socketException.SocketErrorCode, socketException.Message, timeSpent), innerException); 814else if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.WSAENOBUFS) 818else if ((int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_NOT_ENOUGH_MEMORY || 819(int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_NO_SYSTEM_RESOURCES || 820(int)socketException.SocketErrorCode == UnsafeNativeMethods.ERROR_OUTOFMEMORY) 828return new CommunicationException(SR.Format(SR.UDSConnectError, remoteUri.AbsoluteUri, (int)socketException.SocketErrorCode, socketException.Message), innerException); 832return new CommunicationException(SR.Format(SR.UDSConnectErrorWithTimeSpan, remoteUri.AbsoluteUri, (int)socketException.SocketErrorCode, socketException.Message, timeSpent), innerException);