SocketError SocketError SocketError SocketError Enum


定义 Socket 类的错误代码。Defines error codes for the Socket class.

public enum class SocketError
public enum SocketError
type SocketError = 
Public Enum SocketError


AccessDenied AccessDenied AccessDenied AccessDenied 10013

已试图通过被其访问权限禁止的方式访问 SocketAn attempt was made to access a Socket in a way that is forbidden by its access permissions.

AddressAlreadyInUse AddressAlreadyInUse AddressAlreadyInUse AddressAlreadyInUse 10048

通常,只允许使用地址一次。Only one use of an address is normally permitted.

AddressFamilyNotSupported AddressFamilyNotSupported AddressFamilyNotSupported AddressFamilyNotSupported 10047

不支持指定的地址族。The address family specified is not supported. 如果指定了 IPv6 地址族而未在本地计算机上安装 IPv6 堆栈,则会返回此错误。This error is returned if the IPv6 address family was specified and the IPv6 stack is not installed on the local machine. 如果指定了 IPv4 地址族而未在本地计算机上安装 IPv4 堆栈,则会返回此错误。This error is returned if the IPv4 address family was specified and the IPv4 stack is not installed on the local machine.

AddressNotAvailable AddressNotAvailable AddressNotAvailable AddressNotAvailable 10049

选定的 IP 地址在此上下文中无效。The selected IP address is not valid in this context.

AlreadyInProgress AlreadyInProgress AlreadyInProgress AlreadyInProgress 10037

非阻止性 Socket 已有一个操作正在进行中。The nonblocking Socket already has an operation in progress.

ConnectionAborted ConnectionAborted ConnectionAborted ConnectionAborted 10053

此连接由 .NET Framework 或基础套接字提供程序中止。The connection was aborted by the .NET Framework or the underlying socket provider.

ConnectionRefused ConnectionRefused ConnectionRefused ConnectionRefused 10061

远程主机正在主动拒绝连接。The remote host is actively refusing a connection.

ConnectionReset ConnectionReset ConnectionReset ConnectionReset 10054

此连接由远程对等计算机重置。The connection was reset by the remote peer.

DestinationAddressRequired DestinationAddressRequired DestinationAddressRequired DestinationAddressRequired 10039

在对 Socket 的操作中省略了必需的地址。A required address was omitted from an operation on a Socket.

Disconnecting Disconnecting Disconnecting Disconnecting 10101

正常关机正在进行中。A graceful shutdown is in progress.

Fault Fault Fault Fault 10014

基础套接字提供程序检测到无效的指针地址。An invalid pointer address was detected by the underlying socket provider.

HostDown HostDown HostDown HostDown 10064

由于远程主机被关闭,操作失败。The operation failed because the remote host is down.

HostNotFound HostNotFound HostNotFound HostNotFound 11001

无法识别这种主机。No such host is known. 该名称不是正式的主机名或别名。The name is not an official host name or alias.

HostUnreachable HostUnreachable HostUnreachable HostUnreachable 10065

没有到指定主机的网络路由。There is no network route to the specified host.

InProgress InProgress InProgress InProgress 10036

阻止操作正在进行中。A blocking operation is in progress.

Interrupted Interrupted Interrupted Interrupted 10004

已取消阻止 Socket 调用的操作。A blocking Socket call was canceled.

InvalidArgument InvalidArgument InvalidArgument InvalidArgument 10022

Socket 成员提供了一个无效参数。An invalid argument was supplied to a Socket member.

IOPending IOPending IOPending IOPending 997

应用程序已启动一个无法立即完成的重叠操作。The application has initiated an overlapped operation that cannot be completed immediately.

IsConnected IsConnected IsConnected IsConnected 10056

Socket 已连接。The Socket is already connected.

MessageSize MessageSize MessageSize MessageSize 10040

数据报太长。The datagram is too long.

NetworkDown NetworkDown NetworkDown NetworkDown 10050

网络不可用。The network is not available.

NetworkReset NetworkReset NetworkReset NetworkReset 10052

应用程序尝试在已超时的连接上设置 KeepAliveThe application tried to set KeepAlive on a connection that has already timed out.

NetworkUnreachable NetworkUnreachable NetworkUnreachable NetworkUnreachable 10051

不存在到远程主机的路由。No route to the remote host exists.

NoBufferSpaceAvailable NoBufferSpaceAvailable NoBufferSpaceAvailable NoBufferSpaceAvailable 10055

没有可用于 Socket 操作的可用缓冲区空间。No free buffer space is available for a Socket operation.

NoData NoData NoData NoData 11004

在名称服务器上找不到请求的名称或 IP 地址。The requested name or IP address was not found on the name server.

NoRecovery NoRecovery NoRecovery NoRecovery 11003

错误不可恢复或找不到请求的数据库。The error is unrecoverable or the requested database cannot be located.

NotConnected NotConnected NotConnected NotConnected 10057

应用程序试图发送或接收数据,但是 Socket 未连接。The application tried to send or receive data, and the Socket is not connected.

NotInitialized NotInitialized NotInitialized NotInitialized 10093

尚未初始化基础套接字提供程序。The underlying socket provider has not been initialized.

NotSocket NotSocket NotSocket NotSocket 10038

对非套接字尝试 Socket 操作。A Socket operation was attempted on a non-socket.

OperationAborted OperationAborted OperationAborted OperationAborted 995

由于 Socket 已关闭,重叠的操作被中止。The overlapped operation was aborted due to the closure of the Socket.

OperationNotSupported OperationNotSupported OperationNotSupported OperationNotSupported 10045

协议族不支持地址族。The address family is not supported by the protocol family.

ProcessLimit ProcessLimit ProcessLimit ProcessLimit 10067

正在使用基础套接字提供程序的进程过多。Too many processes are using the underlying socket provider.

ProtocolFamilyNotSupported ProtocolFamilyNotSupported ProtocolFamilyNotSupported ProtocolFamilyNotSupported 10046

未实现或未配置协议族。The protocol family is not implemented or has not been configured.

ProtocolNotSupported ProtocolNotSupported ProtocolNotSupported ProtocolNotSupported 10043

未实现或未配置协议。The protocol is not implemented or has not been configured.

ProtocolOption ProtocolOption ProtocolOption ProtocolOption 10042

Socket 使用了未知、无效或不受支持的选项或级别。An unknown, invalid, or unsupported option or level was used with a Socket.

ProtocolType ProtocolType ProtocolType ProtocolType 10041

Socket 的协议类型不正确。The protocol type is incorrect for this Socket.

Shutdown Shutdown Shutdown Shutdown 10058

发送或接收数据的请求未得到允许,因为 Socket 已被关闭。A request to send or receive data was disallowed because the Socket has already been closed.

SocketError SocketError SocketError -1

发生了未指定的 Socket 错误。An unspecified Socket error has occurred.

SocketNotSupported SocketNotSupported SocketNotSupported SocketNotSupported 10044

在此地址族中不存在对指定的套接字类型的支持。The support for the specified socket type does not exist in this address family.

Success Success Success Success 0

Socket 操作成功。The Socket operation succeeded.

SystemNotReady SystemNotReady SystemNotReady SystemNotReady 10091

网络子系统不可用。The network subsystem is unavailable.

TimedOut TimedOut TimedOut TimedOut 10060

连接尝试超时,或者连接的主机没有响应。The connection attempt timed out, or the connected host has failed to respond.

TooManyOpenSockets TooManyOpenSockets TooManyOpenSockets TooManyOpenSockets 10024

基础套接字提供程序中打开的套接字太多。There are too many open sockets in the underlying socket provider.

TryAgain TryAgain TryAgain TryAgain 11002

无法解析主机名。The name of the host could not be resolved. 请稍后再试。Try again later.

TypeNotFound TypeNotFound TypeNotFound TypeNotFound 10109

未找到指定的类。The specified class was not found.

VersionNotSupported VersionNotSupported VersionNotSupported VersionNotSupported 10092

基础套接字提供程序的版本超出范围。The version of the underlying socket provider is out of range.

WouldBlock WouldBlock WouldBlock WouldBlock 10035

对非阻止性套接字的操作不能立即完成。An operation on a nonblocking socket cannot be completed immediately.


基础套接字提供程序返回这些错误大部分。Most of these errors are returned by the underlying socket provider.