UtilPack.ResourcePooling.NetworkStream 1.0.0

Easy-to-use async resource pool for streams operating on sockets.

Install-Package UtilPack.ResourcePooling.NetworkStream -Version 1.0.0
dotnet add package UtilPack.ResourcePooling.NetworkStream --version 1.0.0
<PackageReference Include="UtilPack.ResourcePooling.NetworkStream" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UtilPack.ResourcePooling.NetworkStream --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

UtilPack.ResourcePooling.NetworkStream

This project contains common code when dealing with resources which utilize System.Net.Sockets.NetworkStream and underlying System.Net.Sockets.Socket.
Because the actual System.Net.Sockets.NetworkStream may be (and usually is) encrypted, it is exposed via System.IO.Stream class it inherits (since System.Net.Security.SslStream inherits System.IO.Stream as well).

The NetworkStreamFactory classes (the one without generic type parameters, and the one with one generic type parameter) implement the AsyncResourceFactory interface from UtilPack.ResourcePooling project.
This allows to easily create resource pools which behave in various ways by using extension methods on NetworkStreamFactory.
These resource pools may be then used to easily get and return instances of System.IO.Stream, abstracting away the actual logic of possible DNS resolve and SSL stream creation.

The most common usecase it to have a configuration object inheriting from the ones defined in UtilPack.Configuration.NetworkStream, and then use extension methods in this library to create NetworkStreamFactoryConfiguration.
This created object may be used to call asynchronous socket and stream initialization method NetworkStreamFactory.AcquireNetworkStreamFromConfiguration.
Typically the socket and stream are then hidden behind some protocol-specific facade, like the ones in CBAM project, but that is out of scope of this library.

Distribution

See NuGet package for binary distribution.

UtilPack.ResourcePooling.NetworkStream

This project contains common code when dealing with resources which utilize System.Net.Sockets.NetworkStream and underlying System.Net.Sockets.Socket.
Because the actual System.Net.Sockets.NetworkStream may be (and usually is) encrypted, it is exposed via System.IO.Stream class it inherits (since System.Net.Security.SslStream inherits System.IO.Stream as well).

The NetworkStreamFactory classes (the one without generic type parameters, and the one with one generic type parameter) implement the AsyncResourceFactory interface from UtilPack.ResourcePooling project.
This allows to easily create resource pools which behave in various ways by using extension methods on NetworkStreamFactory.
These resource pools may be then used to easily get and return instances of System.IO.Stream, abstracting away the actual logic of possible DNS resolve and SSL stream creation.

The most common usecase it to have a configuration object inheriting from the ones defined in UtilPack.Configuration.NetworkStream, and then use extension methods in this library to create NetworkStreamFactoryConfiguration.
This created object may be used to call asynchronous socket and stream initialization method NetworkStreamFactory.AcquireNetworkStreamFromConfiguration.
Typically the socket and stream are then hidden behind some protocol-specific facade, like the ones in CBAM project, but that is out of scope of this library.

Distribution

See NuGet package for binary distribution.

Release Notes

Separated common configuration into its own project, and added easy-to-use methods to default usecases of transforming that configuration into NetworkStreamFactoryConfiguration. Added possibility to connect to Unix sockets.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 248 5/26/2018
1.0.0-RC3 188 10/18/2017
1.0.0-RC2 212 9/21/2017
1.0.0-RC1 199 9/20/2017