ArraySegment<Byte> buffer = new ArraySegment<byte>(new Byte[8192]); //if (result1.ToString() == "EOF") // result.EndOfMessage = true; WebSocketReceiveResult result = null; using (var ms = new MemoryStream()) { do { result = await webSocket.ReceiveAsync(buffer, CancellationToken.None); //var result1 = msg.Substring(msg.Length - 3); ms.Write(buffer.Array, buffer.Offset, result.Count); } while (!result.EndOfMessage) ; ms.Seek(0, SeekOrigin.Begin); if (result.MessageType == WebSocketMessageType.Binary) { using (var reader = new StreamReader(ms, Encoding.UTF8)) { // reader.ReadToEnd(); txtOutgoing.Text = reader.ReadToEnd(); } } // return;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)