Class SocketException
The exception that is thrown when a socket error occurs.
Inherited Members
Namespace: System.Net.Sockets
Assembly: System.Net.dll
Syntax
public class SocketException : Exception
Constructors
SocketException(SocketError)
Initializes a new instance of the SocketException class.
Declaration
public SocketException(SocketError errorCode)
Parameters
Type | Name | Description |
---|---|---|
SocketError | errorCode | The error code. |
Properties
ErrorCode
Gets the error code that is associated with this exception.
Declaration
public int ErrorCode { get; }
Property Value
Type | Description |
---|---|
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.