Socket​Error Socket​Error Socket​Error Class

Definition

Provides socket error status for operations on a DatagramSocket, StreamSocket, or StreamSocketListener.

public static class SocketErrorpublic static class SocketErrorPublic Static Class SocketError
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
ID_CAP_NETWORKING [Windows Phone]

Remarks

An error encountered on socket operation is returned as HRESULT value. The GetStatus method on the SocketError object is used to convert an error from a socket operation to a SocketErrorStatus enumeration value. Most of the SocketErrorStatus enumeration values correspond to an error returned by the native Windows sockets operation.

Methods

GetStatus(Int32) GetStatus(Int32) GetStatus(Int32)

Gets a SocketErrorStatus value based on an error encountered by a socket operation.

public static SocketErrorStatus GetStatus(Int32 hresult)public static SocketErrorStatus GetStatus(Int32 hresult)Public Static Function GetStatus(hresult As Int32) As SocketErrorStatus
Parameters
hresult
System.Int32 System.Int32 System.Int32

The error encountered by a socket operation represented as an HRESULT.

Returns

The socket error status value for a socket operation.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
ID_CAP_NETWORKING [Windows Phone]

Remarks

An error encountered on socket operation is returned as HRESULT value. The GetStatus method is used to convert an error from a socket operation to a SocketErrorStatus enumeration value. Most of the SocketErrorStatus enumeration values correspond to an error returned by the native Windows sockets operation.

The SocketError object and the GetStatus method would be used when the developer wants to programmatically handle errors that occur during the operation of an app.