Pat
Pat
CC#
Created by Pat on 7/6/2023 in #help
❔ Reading from ClientWebSocket with BinaryReader
An example of proxying this traffic with the TCP client:
NetworkStream stream = myBinaryReader.BaseStream;
do
{
if (!stream.DataAvailable)
{
continue;
}

var bytesRead = await stream.ReadAsync(buffer, ct);
await webSocket.SendAsync(new ArraySegment<byte>(buffer, 0, read), WebSocketMessageType.Binary, true, ct)
} while( --things are connected-- )
NetworkStream stream = myBinaryReader.BaseStream;
do
{
if (!stream.DataAvailable)
{
continue;
}

var bytesRead = await stream.ReadAsync(buffer, ct);
await webSocket.SendAsync(new ArraySegment<byte>(buffer, 0, read), WebSocketMessageType.Binary, true, ct)
} while( --things are connected-- )
As mentioned above, this works very well. Is it possible with ClientWebSocket to access a similar stream?
3 replies