WebSocket.CreateClientWebSocket(Stream, String, Int32, Int32, TimeSpan, Boolean, ArraySegment<Byte>) 方法
定义
允许调用方创建客户端 WebSocket 类,此类为组帧目的将使用 WSPC。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);
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).
返回
返回 WebSocket。Returns WebSocket.