1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-07-30 13:57:00 +00:00

Renamed clients directory to senders

This commit is contained in:
Michael Hollister 2025-05-28 18:02:59 -05:00
parent 7405cca08f
commit 0d6856872f
30 changed files with 0 additions and 0 deletions

View file

@ -1,46 +0,0 @@
using System.Net.WebSockets;
public class WebSocketStream : Stream
{
private readonly ClientWebSocket _webSocket;
public WebSocketStream(ClientWebSocket webSocket)
{
_webSocket = webSocket;
}
public override bool CanRead => true;
public override bool CanSeek => false;
public override bool CanWrite => true;
public override long Length => throw new NotSupportedException();
public override long Position
{
get => throw new NotSupportedException();
set => throw new NotSupportedException();
}
public override void Flush() { }
public override int Read(byte[] buffer, int offset, int count)
{
var segment = new ArraySegment<byte>(buffer, offset, count);
var result = _webSocket.ReceiveAsync(segment, CancellationToken.None).Result;
return result.Count;
}
public override void Write(byte[] buffer, int offset, int count)
{
var segment = new ArraySegment<byte>(buffer, offset, count);
_webSocket.SendAsync(segment, WebSocketMessageType.Binary, true, CancellationToken.None).Wait();
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotSupportedException();
}
public override void SetLength(long value)
{
throw new NotSupportedException();
}
}