SocketException Constructors

Definition

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(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.

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.

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.

See also

Applies to