WebSocket.CreateClientWebSocket(Stream, String, Int32, Int32, TimeSpan, Boolean, ArraySegment<Byte>) 方法

定義

允許呼叫端建立使用 WSPC 進行框架處理的用戶端 WebSocket 類別。Allows callers to create a client side WebSocket class which will use the WSPC for framing purposes.

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

public:
 static System::Net::WebSockets::WebSocket ^ CreateClientWebSocket(System::IO::Stream ^ innerStream, System::String ^ subProtocol, int receiveBufferSize, int sendBufferSize, TimeSpan keepAliveInterval, bool useZeroMaskingKey, ArraySegment<System::Byte> internalBuffer);
public static System.Net.WebSockets.WebSocket CreateClientWebSocket (System.IO.Stream innerStream, string subProtocol, int receiveBufferSize, int sendBufferSize, TimeSpan keepAliveInterval, bool useZeroMaskingKey, ArraySegment<byte> internalBuffer);
static member CreateClientWebSocket : System.IO.Stream * string * int * int * TimeSpan * bool * ArraySegment<byte> -> System.Net.WebSockets.WebSocket
Public Shared Function CreateClientWebSocket (innerStream As Stream, subProtocol As String, receiveBufferSize As Integer, sendBufferSize As Integer, keepAliveInterval As TimeSpan, useZeroMaskingKey As Boolean, internalBuffer As ArraySegment(Of Byte)) As WebSocket

參數

innerStream
Stream

要用於 IO 作業的連接。The connection to be used for IO operations.

subProtocol
String

用戶端所接受的附屬通訊協定。The subprotocol accepted by the client.

receiveBufferSize
Int32

用戶端 WebSocket 接收緩衝區的大小 (以位元組為單位)。The size in bytes of the client WebSocket receive buffer.

sendBufferSize
Int32

用戶端 WebSocket 傳送緩衝區的大小 (以位元組為單位)。The size in bytes of the client WebSocket send buffer.

keepAliveInterval
TimeSpan

決定如何定期在連線上傳送保持連接的框架。Determines how regularly a frame is sent over the connection as a keep-alive. 僅適用於連線處於閒置狀態時。Applies only when the connection is idle.

useZeroMaskingKey
Boolean

表示隨機金鑰或靜態金鑰 (只是零) 是否應用於 WebSocket 遮罩。Indicates whether a random key or a static key (just zeros) should be used for the WebSocket masking.

internalBuffer
ArraySegment<Byte>

做為 WPC 中的內部緩衝區。Will be used as the internal buffer in the WPC. 大小必須至少為 2 * ReceiveBufferSize + SendBufferSize + 256 + 20 (32 位元時為 16)The size has to be at least 2 * ReceiveBufferSize + SendBufferSize + 256 + 20 (16 on 32-bit).

傳回

傳回 WebSocketReturns WebSocket.

適用於