AspNetWebSocket 类

定义

表示实施全双工连接(在 Web 服务器和 ASP.NET 应用程序中的客户端之间)。Represents a real-time full-duplex connection between a web server and a client in an ASP.NET application.

public ref class AspNetWebSocket sealed : System::Net::WebSockets::WebSocket
public sealed class AspNetWebSocket : System.Net.WebSockets.WebSocket
type AspNetWebSocket = class
    inherit WebSocket
Public NotInheritable Class AspNetWebSocket
Inherits WebSocket
继承
AspNetWebSocket

属性

CloseStatus

获取指示为什么 AspNetWebSocket 对象被关闭的状态码。Gets a status code that indicates why an AspNetWebSocket object was closed.

CloseStatusDescription

获取解释为什么 AspNetWebSocket 对象被关闭的状态消息。Gets a status message that explains why an AspNetWebSocket object was closed.

State

获取一个值,该值指示 AspNetWebSocket 对象的打开或关闭状态。Gets a value that indicates the open or closed state of an AspNetWebSocket object.

SubProtocol

获取远程客户端和服务器可以用来通过 AspNetWebSocket 连接交换数据的应用程序特定的协议的名称。Gets the name of an application-specific protocol that a remote client and a server can use to exchange data over an AspNetWebSocket connection.

方法

Abort()

取消 AspNetWebSocket 对象中的任何挂起的 I/O 操作,并设置该对象的状态,以便它不能用于启动其他的 I/O 操作。Cancels any pending I/O operations on the AspNetWebSocket object and sets the state of the object so that it cannot be used to start additional I/O operations.

CloseAsync(WebSocketCloseStatus, String, CancellationToken)

发送异步消息给客户以关闭连接。Sends an asynchronous message to a client to close the connection. 如果服务器初始化关闭连接请求,则该方法在返回前会一直等待客户端的通知。If the server initiates the request to close the connection, the method waits for the client to acknowledge the request before it returns.

CloseOutputAsync(WebSocketCloseStatus, String, CancellationToken)

发送异步消息给客户以关闭连接。Sends an asynchronous message to a client to close the connection. 若服务器初始化了关闭连接请求,则该方法不会等待响应,直接返回。If the server initiates the request to close the connection, the method returns without waiting for a response.

Dispose()

释放 AspNetWebSocket 对象使用的所有资源。Releases all resources used by an AspNetWebSocket object.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ReceiveAsync(ArraySegment<Byte>, CancellationToken)

从远程客户端接受单个消息片段。Receives a single message fragment from a remote client.

ReceiveAsync(Memory<Byte>, CancellationToken)

WebSocket 连接异步接收数据。Receives data from the WebSocket connection asynchronously.

(继承自 WebSocket)
SendAsync(ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken)

发送单个消息片段到远程客户端。Sends a single message fragment to a remote client.

SendAsync(ReadOnlyMemory<Byte>, WebSocketMessageType, Boolean, CancellationToken)

通过 WebSocket 连接异步发送数据。Sends data over the WebSocket connection asynchronously.

(继承自 WebSocket)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于