CB.System.Net
1.0.0-preview.1
See the version list below for details.
dotnet add package CB.System.Net --version 1.0.0-preview.1
NuGet\Install-Package CB.System.Net -Version 1.0.0-preview.1
<PackageReference Include="CB.System.Net" Version="1.0.0-preview.1" />
<PackageVersion Include="CB.System.Net" Version="1.0.0-preview.1" />
<PackageReference Include="CB.System.Net" />
paket add CB.System.Net --version 1.0.0-preview.1
#r "nuget: CB.System.Net, 1.0.0-preview.1"
#:package CB.System.Net@1.0.0-preview.1
#addin nuget:?package=CB.System.Net&version=1.0.0-preview.1&prerelease
#tool nuget:?package=CB.System.Net&version=1.0.0-preview.1&prerelease
CB.System.Net
This package is only for testing purpose.
CB.System.Net is a collection of networking classes to solve frequently occurring problems: typed TCP clients and listeners, local address and host information, IP end point parsing.
Connectivity (CB.System.Net.Connectivity)
The building blocks of a connection that has to survive: a network that comes and goes, a host that restarts, a DNS that is down.
ReconnectLoop.RunAsync(...)- connect, use, reconnect;ReconnectLoop.WithDeadlineAsync(...)puts a deadline on any step.ReconnectBackoff/ReconnectOptions- exponential, capped, jittered delays, reset only once a connection has been stable.ReconnectPacer+ConnectionFailureLog- pace the retries and log each cause once, then the recovery with the outage's duration.HostResolver- DNS with a deadline and a last-known-good fallback.TcpConnector.ConnectAsync(...)- resolve and connect within one deadline.NetworkFailure.Classify(...)- refused, unreachable, host not found, timed out, TLS rejected, lost: for logs and for the decision to retry.InFlightLimiter,NetworkChangeSignal- bound outstanding work; wake a waiting retry when the network changes.
Logging goes through Microsoft.Extensions.Logging.Abstractions; the clocks are TimeProviders, so every delay is testable.
Adapters and traffic
NetworkLinkSpeed.GetMBps()- the nominal speed of the card the machine really talks through (virtual switches, VPNs and container bridges that claim 10 Gbit/s are skipped unless the OS routes through them);SelectMBps(cards, name)is the choice over adapters you describe.NetworkThroughputMeter(incoming)- measured MB/s over all non-loopback adapters between two calls.
Addresses
IPAddressX.IsLoopbackOrMapped() and IPAddressX.IsLoopbackHost(host) - loopback including the IPv4-mapped IPv6 form a dual-stack server
sees (IPAddress.IsLoopback alone does not cover it on every target).
Traffic monitoring (NetMonitor)
NetMonitor.Start() / Stop() measure the traffic the machine received in between: ReceivedBytes and BytesPerSecond.
- net10.0 and later: native, from the byte counters of the network adapters (loopback excluded). Nothing to install. They count all traffic of
the machine and cannot be filtered: a constructor with a filter throws
PlatformNotSupportedException(NetMonitor.SupportsFiltertells). - net48 and netstandard2.0: packet capture through SharpPcap is the fallback, since those targets have
no native counter that can filter. It needs Npcap (Windows) or libpcap (Linux, macOS) and the right to open a capture device, and it
accepts a pcap filter - build one with
PcapFilterBuilder. SharpPcap is referenced for those two targets only.
Upgrading from 0.4.x
NetMonitor and PcapFilterBuilder stay in this package and namespace (CB.System.Net.Diagnostics). On net10.0 and later NetMonitor is native
and refuses a filter (see above); on net48 and netstandard2.0 it works as before, through SharpPcap. SharpPcap is no longer a dependency of
the net10.0 and net11.0 builds. Also, NetMonitor.BytesPerSecond was computed from TimeSpan.Milliseconds (the 0-999 part) instead of the elapsed
milliseconds, so it was wrong for any interval over a second; that is fixed.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- CB.System (>= 1.0.0-preview.1)
- Microsoft.Bcl.AsyncInterfaces (>= 11.0.0)
- Microsoft.Bcl.TimeProvider (>= 11.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 11.0.0)
- SharpPcap (>= 6.3.1)
-
.NETStandard 2.0
- CB.System (>= 1.0.0-preview.1)
- Microsoft.Bcl.AsyncInterfaces (>= 11.0.0)
- Microsoft.Bcl.TimeProvider (>= 11.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 11.0.0)
- SharpPcap (>= 6.3.1)
-
net10.0
- CB.System (>= 1.0.0-preview.1)
- Microsoft.Extensions.Logging.Abstractions (>= 11.0.0)
-
net11.0
- CB.System (>= 1.0.0-preview.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 410 | 11/17/2026 |
| 1.0.0-preview.1 | 133 | 11/15/2026 |
| 0.4.3 | 5,258 | 1/31/2024 |
| 0.4.2 | 452 | 11/25/2023 |
| 0.4.1 | 280 | 11/9/2023 |
| 0.4.0 | 251 | 11/9/2023 |
| 0.3.0 | 312 | 9/19/2023 |
| 0.2.3 | 896 | 1/1/2021 |
| 0.2.2 | 766 | 12/16/2020 |
| 0.2.1 | 2,597 | 10/27/2020 |
| 0.2.0 | 626 | 10/27/2020 |
| 0.1.4-a | 702 | 7/3/2020 |
| 0.1.3-a | 568 | 7/2/2020 |
| 0.1.1 | 737 | 6/4/2020 |
| 0.1.0 | 786 | 10/4/2019 |