Table of Contents

Class SocketException

Namespace
System.Net.Sockets
Assembly
System.Net.dll

The exception that is thrown when a socket error occurs.

public class SocketException : Exception
Inheritance
SocketException
Inherited Members
Extension Methods

Constructors

SocketException(SocketError)

Initializes a new instance of the SocketException class.

public SocketException(SocketError errorCode)

Parameters

errorCode SocketError

The error code.

Properties

ErrorCode

Gets the error code that is associated with this exception.

public int ErrorCode { get; }

Property Value

int

Remarks

The ErrorCode property contains the error code that is associated with the error that caused the exception.

The default constructor for SocketException sets the ErrorCode property to the last operating system error that occurred. For more information about socket error codes, see the Windows Sockets version 2 API error code documentation in MSDN.