ClientWebSocket ClientWebSocket ClientWebSocket ClientWebSocket Class

定義

提供連接至 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
繼承
ClientWebSocketClientWebSocketClientWebSocketClientWebSocket
實作

備註

部分類別和類別中的項目System.Net.WebSocketsWindows 7、 Windows Vista SP2 和 Windows Server 2008 上支援命名空間。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 上支援的用戶端和伺服器 WebSockets 只有 public 的實作。However, the only public implementations of client and server WebSockets are supported on Windows 8 and Windows Server 2012. 中的類別項目System.Net.WebSocketsWindows 7、 Windows Vista SP2 和 Windows Server 2008 支援的命名空間都是抽象類別的項目。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() ClientWebSocket() ClientWebSocket()

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

屬性

CloseStatus CloseStatus CloseStatus CloseStatus

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

CloseStatusDescription CloseStatusDescription CloseStatusDescription CloseStatusDescription

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

Options Options Options Options

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

State State State State

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

SubProtocol SubProtocol SubProtocol SubProtocol

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

方法

Abort() Abort() Abort() Abort()

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

CloseAsync(WebSocketCloseStatus, String, CancellationToken) CloseAsync(WebSocketCloseStatus, String, CancellationToken) CloseAsync(WebSocketCloseStatus, String, CancellationToken) CloseAsync(WebSocketCloseStatus, String, CancellationToken)

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

CloseOutputAsync(WebSocketCloseStatus, String, CancellationToken) CloseOutputAsync(WebSocketCloseStatus, String, CancellationToken) CloseOutputAsync(WebSocketCloseStatus, String, CancellationToken) CloseOutputAsync(WebSocketCloseStatus, String, CancellationToken)

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

ConnectAsync(Uri, CancellationToken) ConnectAsync(Uri, CancellationToken) ConnectAsync(Uri, CancellationToken) ConnectAsync(Uri, CancellationToken)

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

Dispose() Dispose() Dispose() Dispose()

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ReceiveAsync(ArraySegment<Byte>, CancellationToken) ReceiveAsync(ArraySegment<Byte>, CancellationToken) ReceiveAsync(ArraySegment<Byte>, CancellationToken) ReceiveAsync(ArraySegment<Byte>, CancellationToken)

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

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

ClientWebSocket 的資料當成非同步作業傳送。Send data on ClientWebSocket as an asynchronous operation.

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

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

(Inherited from Object)

適用於