SocketException 构造函数

定义

初始化 SocketException 类的新实例。

重载

SocketException()

用最后一个操作系统错误代码初始化 SocketException 类的新实例。

SocketException(Int32)

用指定的错误代码初始化 SocketException 类的新实例。

SocketException(Int32, String)

使用指定的错误代码和消息初始化 类的新实例 SocketException

SocketException(SerializationInfo, StreamingContext)
已过时.

SocketExceptionSerializationInfo 类的指定实例初始化 StreamingContext 类的新实例。

SocketException()

Source:
SocketException.Unix.cs
Source:
SocketException.Unix.cs
Source:
SocketException.Unix.cs

用最后一个操作系统错误代码初始化 SocketException 类的新实例。

public:
 SocketException();
public SocketException ();
Public Sub New ()

注解

构造 SocketException 函数将 ErrorCode 属性设置为发生的最后一个操作系统套接字错误。 有关套接字错误代码的详细信息,请参阅 Windows 套接字版本 2 API 错误代码 文档。

适用于

SocketException(Int32)

Source:
SocketException.cs
Source:
SocketException.cs
Source:
SocketException.cs

用指定的错误代码初始化 SocketException 类的新实例。

public:
 SocketException(int errorCode);
public SocketException (int errorCode);
new System.Net.Sockets.SocketException : int -> System.Net.Sockets.SocketException
Public Sub New (errorCode As Integer)

参数

errorCode
Int32

指示发生的错误的错误代码。

注解

构造 SocketException 函数将 ErrorCode 属性设置为 errorCode

适用于

SocketException(Int32, String)

Source:
SocketException.cs
Source:
SocketException.cs

使用指定的错误代码和消息初始化 类的新实例 SocketException

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)

参数

errorCode
Int32

指示发生的错误的错误代码。

message
String

描述错误的消息。

适用于

SocketException(SerializationInfo, StreamingContext)

Source:
SocketException.cs
Source:
SocketException.cs
Source:
SocketException.cs

注意

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

SocketExceptionSerializationInfo 类的指定实例初始化 StreamingContext 类的新实例。

protected:
 SocketException(System::Runtime::Serialization::SerializationInfo ^ serializationInfo, System::Runtime::Serialization::StreamingContext streamingContext);
protected SocketException (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
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
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
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)

参数

serializationInfo
SerializationInfo

SerializationInfo 实例,包含序列化新的 SocketException 实例所需的信息。

streamingContext
StreamingContext

StreamingContext,包含与新的 SocketException 实例关联的序列化流的源。

属性

注解

此构造函数实现 ISerializable 类的 SocketException 接口。

另请参阅

适用于