public void SetBuffer(int receiveBufferSize, int sendBufferSize, ArraySegment <byte> buffer) { ThrowIfReadOnly(); WebSocketHelpers.ValidateBufferSizes(receiveBufferSize, sendBufferSize); WebSocketHelpers.ValidateArraySegment(buffer, "buffer"); WebSocketBuffer.Validate(buffer.Count, receiveBufferSize, sendBufferSize, false); this.receiveBufferSize = receiveBufferSize; this.sendBufferSize = sendBufferSize; // Only full-trust applications can specify their own buffer to be used as the // internal buffer for the WebSocket object. This is because the contents of the // buffer are used internally by the WebSocket as it marshals data with embedded // pointers to native code. A malicious application could use this to corrupt // native memory. if (AppDomain.CurrentDomain.IsFullyTrusted) { this.buffer = buffer; } else { // We silently ignore the passed in buffer and will create an internal // buffer later. this.buffer = null; } }
public void SetBuffer(int receiveBufferSize, int sendBufferSize) { ThrowIfReadOnly(); WebSocketHelpers.ValidateBufferSizes(receiveBufferSize, sendBufferSize); this.buffer = null; this.receiveBufferSize = receiveBufferSize; this.sendBufferSize = sendBufferSize; }
public void SetBuffer(int receiveBufferSize, int sendBufferSize, ArraySegment <byte> buffer) { ThrowIfReadOnly(); WebSocketHelpers.ValidateBufferSizes(receiveBufferSize, sendBufferSize); WebSocketHelpers.ValidateArraySegment(buffer, "buffer"); WebSocketBuffer.Validate(buffer.Count, receiveBufferSize, sendBufferSize, false); this.receiveBufferSize = receiveBufferSize; this.sendBufferSize = sendBufferSize; this.buffer = buffer; }
public static ArraySegment <byte> CreateServerBuffer(int receiveBufferSize) { WebSocketHelpers.ValidateBufferSizes(receiveBufferSize, WebSocketBuffer.MinSendBufferSize); return(WebSocketBuffer.CreateInternalBufferArraySegment(receiveBufferSize, WebSocketBuffer.MinSendBufferSize, true)); }
public static ArraySegment <byte> CreateClientBuffer(int receiveBufferSize, int sendBufferSize) { WebSocketHelpers.ValidateBufferSizes(receiveBufferSize, sendBufferSize); return(WebSocketBuffer.CreateInternalBufferArraySegment(receiveBufferSize, sendBufferSize, false)); }