通过


SocketException 构造函数

定义

初始化 SocketException 类的新实例。

重载

名称 说明
SocketException()

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

SocketException(Int32)

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

SocketException(Int32, String)

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

SocketException(SerializationInfo, StreamingContext)
已过时.

从类的SocketException指定实例初始化类的新实例SerializationInfoStreamingContext

SocketException()

Source:
SocketException.Unix.cs
Source:
SocketException.Unix.cs
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
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
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
Source:
SocketException.cs
Source:
SocketException.cs

注意

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

从类的SocketException指定实例初始化类的新实例SerializationInfoStreamingContext

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);
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}")>]
new System.Net.Sockets.SocketException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.Sockets.SocketException
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 接口。

另请参阅

适用于