WebSocket.CreateClientWebSocket 方法

定义

允许调用方创建客户端 WebSocket 类,此类为组帧目的将使用 WSPC。

此 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);
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 操作的连接。

subProtocol
String

被客户端接受的子协议。

receiveBufferSize
Int32

客户 WebSocket 接收缓冲区的大小(以字节为单位)。

sendBufferSize
Int32

客户端 WebSocket 发送缓冲区的大小(以字节为单位)。

keepAliveInterval
TimeSpan

确定帧是如何定期通过维弧连接发送的。 仅当连接空闲时应用。

useZeroMaskingKey
Boolean

指示随机键或静态键(仅指零)是否应针对 WebSocket 掩码而使用。

internalBuffer
ArraySegment<Byte>

在 WPC 中将用作内部缓冲区。 大小必须至少 2 * ReceiveBufferSize + SendBufferSize + 256 + 20 (16 on 32-bit)为 。

返回

返回 WebSocket

适用于