❔ Reading from ClientWebSocket with BinaryReader
I am building an app to work as a gateway between a consumer connecting to a .NET websocket server and then proxying that to a TCP backend server. This code currently works quite well for TCP clients and makes use of the BinaryReader / BinaryWriter to proxy between the WebSocket and the TCPClient classes.
I'm trying to replicate the same behavior between a ClientWebSocket and a Websocket but can't seem to find a solution to reading each "packet" the binary ClientWebSocket receives. Wireshark shows the data I would expect but calling ClientWebSocket.ReceiveAsync results in odd counts that do not match the packets.
I'm trying to replicate the same behavior between a ClientWebSocket and a Websocket but can't seem to find a solution to reading each "packet" the binary ClientWebSocket receives. Wireshark shows the data I would expect but calling ClientWebSocket.ReceiveAsync results in odd counts that do not match the packets.
2 Replies
An example of proxying this traffic with the TCP client:
As mentioned above, this works very well. Is it possible with ClientWebSocket to access a similar stream?
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.