SocketError 列舉


定義 Socket 類別的錯誤碼。Defines error codes for the Socket class.

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


AccessDenied 10013

嘗試以其存取權限所禁止的方式存取 SocketAn attempt was made to access a Socket in a way that is forbidden by its access permissions.

AddressAlreadyInUse 10048

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

AddressFamilyNotSupported 10047

不支援指定的通訊協定家族 (Family)。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 10049

選取的 IP 位址在這個內容中無效。The selected IP address is not valid in this context.

AlreadyInProgress 10037

未封鎖的 Socket 中有一個作業尚未完成。The nonblocking Socket already has an operation in progress.

ConnectionAborted 10053

連接已由 .NET Framework 或基礎通訊端提供者中止。The connection was aborted by the .NET Framework or the underlying socket provider.

ConnectionRefused 10061

遠端主機正在拒絕連接。The remote host is actively refusing a connection.

ConnectionReset 10054

連接已由遠端對等個體重設。The connection was reset by the remote peer.

DestinationAddressRequired 10039

所需位址已從 Socket 上的作業中省略。A required address was omitted from an operation on a Socket.

Disconnecting 10101

非失誤性的關機尚未完成。A graceful shutdown is in progress.

Fault 10014

基礎通訊端提供者偵測到無效的指標位址。An invalid pointer address was detected by the underlying socket provider.

HostDown 10064

作業失敗,因為遠端主機已關閉。The operation failed because the remote host is down.

HostNotFound 11001

沒有已知的此類主機。No such host is known. 名稱不是正式主機名稱或別名。The name is not an official host name or alias.

HostUnreachable 10065

沒有至指定主機的網路路由。There is no network route to the specified host.

InProgress 10036

封鎖作業尚未完成。A blocking operation is in progress.

Interrupted 10004

已取消封鎖 Socket 呼叫。A blocking Socket call was canceled.

InvalidArgument 10022

Socket 成員提供的引數無效。An invalid argument was supplied to a Socket member.

IOPending 997

應用程式初始化了無法立即完成的重疊作業。The application has initiated an overlapped operation that cannot be completed immediately.

IsConnected 10056

已連接 SocketThe Socket is already connected.

MessageSize 10040

資料包太長。The datagram is too long.

NetworkDown 10050

網路無法使用。The network is not available.

NetworkReset 10052

應用程式嘗試在已逾時的連接上設定 KeepAliveThe application tried to set KeepAlive on a connection that has already timed out.

NetworkUnreachable 10051

不存在至遠端主機的路由。No route to the remote host exists.

NoBufferSpaceAvailable 10055

沒有可用於 Socket 作業的可用緩衝區空間。No free buffer space is available for a Socket operation.

NoData 11004

名稱伺服器上找不到所要求的名稱或 IP 位址。The requested name or IP address was not found on the name server.

NoRecovery 11003

錯誤無法復原,或找不到所要求的資料庫。The error is unrecoverable or the requested database cannot be located.

NotConnected 10057

應用程式嘗試傳送或接收資料,而 Socket 未連接。The application tried to send or receive data, and the Socket is not connected.

NotInitialized 10093

基礎通訊端提供者尚未初始化。The underlying socket provider has not been initialized.

NotSocket 10038

在非通訊端上嘗試 Socket 作業。A Socket operation was attempted on a non-socket.

OperationAborted 995

重疊作業因 Socket 的關閉而中止。The overlapped operation was aborted due to the closure of the Socket.

OperationNotSupported 10045

通訊協定家族不支援位址家族。The address family is not supported by the protocol family.

ProcessLimit 10067

使用基礎通訊端提供者的處理序過多。Too many processes are using the underlying socket provider.

ProtocolFamilyNotSupported 10046

未實作或尚未設定通訊協定家族。The protocol family is not implemented or has not been configured.

ProtocolNotSupported 10043

未實作或尚未設定通訊協定。The protocol is not implemented or has not been configured.

ProtocolOption 10042

Socket 搭配使用了未知、無效或不受支援的選項或層級。An unknown, invalid, or unsupported option or level was used with a Socket.

ProtocolType 10041

這個 Socket 的通訊協定類型不正確。The protocol type is incorrect for this Socket.

Shutdown 10058

不允許要求傳送或接收資料,因為 Socket 已關閉。A request to send or receive data was disallowed because the Socket has already been closed.

SocketError -1

發生未指定的 Socket 錯誤。An unspecified Socket error has occurred.

SocketNotSupported 10044

這個地址家族中不存在對指定通訊端類型的支援。The support for the specified socket type does not exist in this address family.

Success 0

Socket 作業已成功。The Socket operation succeeded.

SystemNotReady 10091

網路子系統無法使用。The network subsystem is unavailable.

TimedOut 10060

連接嘗試逾時,或連接的主機無法回應。The connection attempt timed out, or the connected host has failed to respond.

TooManyOpenSockets 10024

基礎通訊端提供者中開啟的通訊端過多。There are too many open sockets in the underlying socket provider.

TryAgain 11002

無法解析主機的名稱。The name of the host could not be resolved. 請稍後再試一次。Try again later.

TypeNotFound 10109

找不到指定的類別。The specified class was not found.

VersionNotSupported 10092

基礎通訊端提供者的版本超出範圍。The version of the underlying socket provider is out of range.

WouldBlock 10035

無法立即完成未封鎖通訊端上的作業。An operation on a nonblocking socket cannot be completed immediately.


這些錯誤大多是由基礎通訊端提供者傳回。Most of these errors are returned by the underlying socket provider.