SocketError SocketError SocketError SocketError Class

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

Syntax

Declaration

public static class SocketErrorpublic static class SocketErrorPublic Static Class SocketErrorpublic static class SocketError

Remarks

An error encountered on socket operation is returned as HRESULT value. The GetStatus(Int32) 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 summary

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

Methods

  • GetStatus(Int32)
    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 SocketErrorStatuspublic static SocketErrorStatus GetStatus(Int32 hresult)

    Parameters

    • hresult
      System.Int32
      System.Int32
      System.Int32
      System.Int32

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

    Returns

    Remarks

    An error encountered on socket operation is returned as HRESULT value. The GetStatus(Int32) 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(Int32) method would be used when the developer wants to programmatically handle errors that occur during the operation of an app.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Capabilities

ID_CAP_NETWORKING [Windows Phone]

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Networking.Sockets.dll