Skip to content

Specialized .NET Streams for full duplex in-proc communication, web sockets, and multiplexing

License

Notifications You must be signed in to change notification settings

dbeattie71/Nerdbank.Streams

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Specialized .NET Stream classes

NuGet package

Build status Travis (.org) codecov

Features

The streams in this package focus on communication (not persistence).

  1. HalfDuplexStream is meant to allow two parties to communicate one direction. Anything written to the stream can subsequently be read from it. You can share this Stream with any two parties (in the same AppDomain) and one can send messages to the other.
  2. FullDuplexStream provides two Stream objects, which you assign out to each of two parties. These parties can now send and receive messages with each other by reading from and writing to their assigned Stream instance.
  3. MultiplexingStream allows you to split any bidirectional .NET Stream into many sub-streams (called channels). This allows two parties to establish just one transport stream (e.g. named pipe or web socket) and use it for many independent protocols. For example, one might set up JSON-RPC on one channel and use other channels for efficient binary transfers.
  4. AsStream() wraps a WebSocket, System.IO.Pipelines.PipeReader, System.IO.Pipelines.PipeWriter, or System.IO.Pipelines.IDuplexPipe with a System.IO.Stream for reading and/or writing.
  5. UsePipe() enables reading from and writing to a Stream or WebSocket using the PipeReader and PipeWriter APIs.
  6. Stream.ReadSlice(int) creates a sub-stream that ends after a given number of bytes.
  7. MonitoringStream wraps another Stream and raises events for all I/O calls so you can monitor and/or trace the data as it goes by.
  8. WriteSubstream and ReadSubstream allow you to serialize data of an unknown length as part of a larger stream, and later deserialize it such in reading the substream, you cannot read more bytes than were written to it.
  9. Sequence<T> is a builder for ReadOnlySequence<T>.

About

Specialized .NET Streams for full duplex in-proc communication, web sockets, and multiplexing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%