ClientWebSocket 類別

定義

提供用於連線到 WebSocket 服務的用戶端。Provides a client for connecting to WebSocket services.

public ref class ClientWebSocket : System::Net::WebSockets::WebSocket, IDisposable
public class ClientWebSocket : System.Net.WebSockets.WebSocket, IDisposable
type ClientWebSocket = class
    inherit WebSocket
    interface IDisposable
Public Class ClientWebSocket
Inherits WebSocket
Implements IDisposable
繼承
ClientWebSocket
實作

備註

Windows 7、Windows Vista SP2 和 Windows Server 2008 支援 System.Net.WebSockets 命名空間中的某些類別和類別元素。Some of the classes and class elements in the System.Net.WebSockets namespace are supported on Windows 7, Windows Vista SP2, and Windows Server 2008. 不過,Windows 8 和 Windows Server 2012 僅支援用戶端和伺服器 Websocket 的唯一公用部署。However, the only public implementations of client and server WebSockets are supported on Windows 8 and Windows Server 2012. 在 Windows 7、Windows Vista SP2 和 Windows Server 2008 上支援的 System.Net.WebSockets 命名空間中的類別元素是抽象類別元素。The class elements in the System.Net.WebSockets namespace that are supported on Windows 7, Windows Vista SP2, and Windows Server 2008 are abstract class elements. 這可讓應用程式開發人員以實際的用戶端 Websocket 執行,來繼承和擴充這些抽象類別類別和類別元素。This allows an application developer to inherit and extend these abstract class classes and class elements with an actual implementation of client WebSockets.

建構函式

ClientWebSocket()

建立 ClientWebSocket 類別的執行個體。Creates an instance of the ClientWebSocket class.

屬性

CloseStatus

取得已在 ClientWebSocket 執行個體上起始關閉訊號交換的原因。Gets the reason why the close handshake was initiated on ClientWebSocket instance.

CloseStatusDescription

取得 ClientWebSocket 執行個體關閉原因的描述。Gets a description of the reason why the ClientWebSocket instance was closed.

Options

取得 ClientWebSocket 執行個體的 WebSocket 選項。Gets the WebSocket options for the ClientWebSocket instance.

State

取得 ClientWebSocket 執行個體的 WebSocket 狀態。Gets the WebSocket state of the ClientWebSocket instance.

SubProtocol

取得 ClientWebSocket 執行個體受支援的 WebSocket 子通訊協定。Gets the supported WebSocket sub-protocol for the ClientWebSocket instance.

方法

Abort()

中止連接,並取消任何暫止的 IO 作業。Aborts the connection and cancels any pending IO operations.

CloseAsync(WebSocketCloseStatus, String, CancellationToken)

以非同步作業方式關閉 ClientWebSocket 執行個體。Close the ClientWebSocket instance as an asynchronous operation.

CloseOutputAsync(WebSocketCloseStatus, String, CancellationToken)

以非同步作業方式關閉 ClientWebSocket 執行個體的輸出。Close the output for the ClientWebSocket instance as an asynchronous operation.

ConnectAsync(Uri, CancellationToken)

以非同步作業的方式連接到 WebSocket 伺服器。Connect to a WebSocket server as an asynchronous operation.

Dispose()

釋放由 ClientWebSocket 執行個體使用的 Unmanaged 資源。Releases the unmanaged resources used by the ClientWebSocket instance.

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)

ClientWebSocket 上的資料當成非同步作業接收。Receives data on ClientWebSocket as an asynchronous operation.

ReceiveAsync(Memory<Byte>, CancellationToken)

ClientWebSocket 上的資料當成非同步作業接收。Receives data on ClientWebSocket as an asynchronous operation.

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

以非同步作業傳送 ClientWebSocket 上的資料。Sends data on ClientWebSocket as an asynchronous operation.

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

以非同步作業從唯讀位元組記憶體範圍傳送 ClientWebSocket 上的資料。Sends data on ClientWebSocket from a read-only byte memory range as an asynchronous operation.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於