CoreSuite.Connectivity
1.0.0
See the version list below for details.
dotnet add package CoreSuite.Connectivity --version 1.0.0
NuGet\Install-Package CoreSuite.Connectivity -Version 1.0.0
<PackageReference Include="CoreSuite.Connectivity" Version="1.0.0" />
<PackageVersion Include="CoreSuite.Connectivity" Version="1.0.0" />
<PackageReference Include="CoreSuite.Connectivity" />
paket add CoreSuite.Connectivity --version 1.0.0
#r "nuget: CoreSuite.Connectivity, 1.0.0"
#:package CoreSuite.Connectivity@1.0.0
#addin nuget:?package=CoreSuite.Connectivity&version=1.0.0
#tool nuget:?package=CoreSuite.Connectivity&version=1.0.0
CoreSuite Connectivity
CoreSuite.Connectivity is a lightweight .NET 8 service for checking internet availability and continuously monitoring connection changes.
It tests multiple well-known HTTPS endpoints and considers connectivity available when at least one responds successfully.
Features
- Asynchronous and synchronous availability checks.
- Continuous background monitoring.
- Configurable monitoring interval.
- Status-change, connection and disconnection events.
- No external package dependencies.
- Predictable cleanup through
IDisposable.
Requirements
- .NET 8 or a compatible target framework
Installation
dotnet add package CoreSuite.Connectivity
Check once
Prefer the asynchronous API:
Using ConnectivityService As New Connectivity()
Dim IsOnline As Boolean = Await ConnectivityService.IsAvailableAsync()
End Using
The synchronous alternative is:
Dim IsOnline As Boolean = ConnectivityService.IsAvailable()
Monitor continuously
Public Class MainForm
Private ReadOnly ConnectivityService As New Connectivity()
Public Sub New()
InitializeComponent()
ConnectivityService.MonitoringInterval = TimeSpan.FromSeconds(2)
AddHandler ConnectivityService.ConnectivityChanged, AddressOf ConnectivityService_ConnectivityChanged
AddHandler ConnectivityService.Connected, Sub(Sender, E) Debug.WriteLine("Connected")
AddHandler ConnectivityService.Disconnected, Sub(Sender, E) Debug.WriteLine("Disconnected")
ConnectivityService.StartMonitoring()
End Sub
Private Sub ConnectivityService_ConnectivityChanged(Sender As Object, E As ConnectivityEventArgs)
Debug.WriteLine($"Internet available: {E.InternetAvailable}")
End Sub
Protected Overrides Sub OnFormClosed(E As FormClosedEventArgs)
ConnectivityService.Dispose()
MyBase.OnFormClosed(E)
End Sub
End Class
Properties
| Property | Type | Default | Description |
|---|---|---|---|
MonitoringInterval |
TimeSpan |
1 second | Delay between monitoring checks. |
IsMonitoring |
Boolean |
Read-only | Whether continuous monitoring is active. |
IsConnected |
Boolean |
Read-only | Last stored monitoring status. |
Methods
| Method | Description |
|---|---|
IsAvailableAsync() |
Performs a fresh asynchronous availability check. |
IsAvailable() |
Performs a fresh synchronous check. |
StartMonitoring() |
Starts background monitoring. |
StopMonitoring() |
Stops background monitoring. |
Dispose() |
Stops monitoring and releases resources. |
Events
| Event | Raised when |
|---|---|
ConnectivityChanged |
The detected status changes. InternetAvailable contains the new state. |
Connected |
Status changes to available. |
Disconnected |
Status changes to unavailable. |
Important behavior
- Availability of one tested endpoint does not guarantee every internet service is reachable.
IsConnectedis the stored monitoring state. UseIsAvailableAsync()for a fresh result.- Monitoring events may run outside the UI thread. Marshal UI changes when required.
- Set
MonitoringIntervalto a positive value. - Dispose long-lived instances when their owner shuts down.
License
MIT License.
Repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 was computed. 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. |
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CoreSuite.Connectivity:
| Package | Downloads |
|---|---|
|
CoreSuite.ExceptionReporter
UI-independent .NET 8 service for capturing, serializing, saving and emailing structured exception reports. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release of the Connectivity service.