SocketError Enumeration

Defines error codes for the Socket class.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

public enum SocketError

Member nameDescription
SuccessThe Socket operation succeeded.
SocketErrorAn unspecified Socket error has occurred.
InterruptedA blocking Socket call was canceled.
AccessDeniedAn attempt was made to access a Socket in a way that is forbidden by its access permissions.
FaultAn invalid pointer address was detected by the underlying socket provider.
InvalidArgumentAn invalid argument was supplied to a Socket member.
TooManyOpenSocketsThere are too many open sockets in the underlying socket provider.
WouldBlockAn operation on a nonblocking socket cannot be completed immediately.
InProgressA blocking operation is in progress.
AlreadyInProgressThe nonblocking Socket already has an operation in progress.
NotSocketA Socket operation was attempted on a non-socket.
DestinationAddressRequiredA required address was omitted from an operation on a Socket.
MessageSizeThe datagram is too long.
ProtocolTypeThe protocol type is incorrect for this Socket.
ProtocolOptionAn unknown, invalid, or unsupported option or level was used with a Socket.
ProtocolNotSupportedThe protocol is not implemented or has not been configured.
SocketNotSupportedThe support for the specified socket type does not exist in this address family.
OperationNotSupportedThe address family is not supported by the protocol family.
ProtocolFamilyNotSupportedThe protocol family is not implemented or has not been configured.
AddressFamilyNotSupportedThe address family specified is not supported. This error is returned if the IPv6 address family was specified and the IPv6 stack is not installed on the local machine. This error is returned if the IPv4 address family was specified and the IPv4 stack is not installed on the local machine.
AddressAlreadyInUseOnly one use of an address is normally permitted.
AddressNotAvailableThe selected IP address is not valid in this context.
NetworkDownThe network is not available.
NetworkUnreachableNo route to the remote host exists.
NetworkResetThe application tried to set KeepAlive on a connection that has already timed out.
ConnectionAbortedThe connection was aborted by the .NET Framework or the underlying socket provider.
ConnectionResetThe connection was reset by the remote peer.
NoBufferSpaceAvailableNo free buffer space is available for a Socket operation.
IsConnectedThe Socket is already connected.
NotConnectedThe application tried to send or receive data, and the Socket is not connected.
ShutdownA request to send or receive data was disallowed because the Socket has already been closed.
TimedOutThe connection attempt timed out, or the connected host has failed to respond.
ConnectionRefusedThe remote host is actively refusing a connection.
HostDownThe operation failed because the remote host is down.
HostUnreachableThere is no network route to the specified host.
ProcessLimitToo many processes are using the underlying socket provider.
SystemNotReadyThe network subsystem is unavailable.
VersionNotSupportedThe version of the underlying socket provider is out of range.
NotInitializedThe underlying socket provider has not been initialized.
DisconnectingA graceful shutdown is in progress.
TypeNotFoundThe specified class was not found.
HostNotFoundNo such host is known. The name is not an official host name or alias.
TryAgainThe name of the host could not be resolved. Try again later.
NoRecoveryThe error is unrecoverable or the requested database cannot be located.
NoDataThe requested name or IP address was not found on the name server.
IOPendingThe application has initiated an overlapped operation that cannot be completed immediately.
OperationAbortedThe overlapped operation was aborted due to the closure of the Socket.

Most of these errors are returned by the underlying socket provider.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft