SocketException Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the SocketException class.
Overloads
SocketException() |
Initializes a new instance of the SocketException class with the last operating system error code. |
SocketException(Int32) |
Initializes a new instance of the SocketException class with the specified error code. |
SocketException(Int32, String) | |
SocketException(SerializationInfo, StreamingContext) |
Initializes a new instance of the SocketException class from the specified instances of the SerializationInfo and StreamingContext classes. |
SocketException()
Initializes a new instance of the SocketException class with the last operating system error code.
public:
SocketException();
public SocketException ();
Public Sub New ()
Remarks
The SocketException constructor sets the ErrorCode property to the last operating system socket error that occurred. For more information about socket error codes, see the Windows Sockets version 2 API error code documentation.
Applies to
SocketException(Int32)
Initializes a new instance of the SocketException class with the specified error code.
public:
SocketException(int errorCode);
public SocketException (int errorCode);
new System.Net.Sockets.SocketException : int -> System.Net.Sockets.SocketException
Public Sub New (errorCode As Integer)
Parameters
- errorCode
- Int32
The error code that indicates the error that occurred.
Remarks
The SocketException constructor sets the ErrorCode property to errorCode
.
Applies to
SocketException(Int32, String)
public:
SocketException(int errorCode, System::String ^ message);
public SocketException (int errorCode, string? message);
new System.Net.Sockets.SocketException : int * string -> System.Net.Sockets.SocketException
Public Sub New (errorCode As Integer, message As String)
Parameters
- errorCode
- Int32
- message
- String
Applies to
SocketException(SerializationInfo, StreamingContext)
Initializes a new instance of the SocketException class from the specified instances of the SerializationInfo and StreamingContext classes.
protected:
SocketException(System::Runtime::Serialization::SerializationInfo ^ serializationInfo, System::Runtime::Serialization::StreamingContext streamingContext);
protected SocketException (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
new System.Net.Sockets.SocketException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.Sockets.SocketException
Protected Sub New (serializationInfo As SerializationInfo, streamingContext As StreamingContext)
Parameters
- serializationInfo
- SerializationInfo
A SerializationInfo instance that contains the information that is required to serialize the new SocketException instance.
- streamingContext
- StreamingContext
A StreamingContext that contains the source of the serialized stream that is associated with the new SocketException instance.
Remarks
This constructor implements the ISerializable interface for the SocketException class.