Ever wondered how to run network diagnostics like Ping, Traceroute, or DNS queries from probes scattered across the globe? Enter Globalping.NET, a powerful library that makes it effortless to interact with the Globalping API using C#. Whether you're debugging latency issues or exploring packet routes, this library has you covered.
In this blog, we'll dive into the features of Globalping.NET, explore real-world examples, and show you how to get started with this amazing tool. If you're a PowerShell enthusiast, check out our companion blog on Globalping PowerShell Module to see how these tools complement each other.
Globalping is a free API that requires no registration to get started. Here are the limits:
Higher limits are available for members, making it ideal for both casual and professional use.
Globalping.NET provides a rich set of methods to interact with the Globalping API:
With these methods, you can create, execute, and analyze network diagnostics with ease, all while leveraging advanced features like Brotli compression and ETag caching.
Globalping.NET is your gateway to running network diagnostics from hundreds of probes worldwide. With support for Ping, Traceroute, MTR, DNS, and HTTP measurements, it simplifies complex tasks into a few lines of code. Here's why you should consider it:
Add the package from NuGet:
> dotnet add package Globalping
Alternatively, reference the project directly if you're working within the repository.
You can start using Globalping without an API key. Here's how to run a Ping from Germany:
using var httpClient = new HttpClient();
var builder = new MeasurementRequestBuilder()
.WithType(MeasurementType.Ping)
.WithTarget("cdn.jsdelivr.net")
.AddCountry("DE")
.Build();
var probeService = new ProbeService(httpClient);
var measurement = await probeService.CreateMeasurementAsync(builder);
Console.WriteLine($"Measurement ID: {measurement.Id}");
For higher limits and more probes, use the apiKey
parameter:
using var httpClient = new HttpClient();
var builder = new MeasurementRequestBuilder()
.WithType(MeasurementType.Ping)
.WithTarget("cdn.jsdelivr.net")
.AddCountry("DE")
.Build();
var probeService = new ProbeService(httpClient, "your-api-key");
var measurement = await probeService.CreateMeasurementAsync(builder);
Console.WriteLine($"Measurement ID: {measurement.Id}");
For HTTP measurements, you can specify methods, paths, and query strings. Here's an example:
var builder = new MeasurementRequestBuilder()
.WithType(MeasurementType.Http)
.WithTarget("https://example.com/api/data?x=1")
.WithMeasurementOptions(new HttpOptions
{
Request = new HttpRequestOptions
{
Method = HttpRequestMethod.GET,
Path = "/api/data",
Query = "x=1"
},
Protocol = HttpProtocol.HTTPS,
IpVersion = IpVersion.Six
});
var request = builder.Build();
using var httpClient = new HttpClient();
var probeService = new ProbeService(httpClient);
var measurement = await probeService.CreateMeasurementAsync(request);
Console.WriteLine($"HTTP Measurement ID: {measurement.Id}");
Keep an eye on your API usage with the GetLimitsAsync
method:
using var httpClient = new HttpClient();
var probeService = new ProbeService(httpClient, "your-api-key");
var limits = await probeService.GetLimitsAsync();
Console.WriteLine($"Credits Remaining: {limits.CreditsRemaining}");
If you're working in both C# and PowerShell, the Globalping ecosystem has you covered. Use Globalping PowerShell Module for quick scripting and automation, and leverage Globalping.NET for robust application development. Together, they form a powerful toolkit for network diagnostics.
Explore the source code and contribute to the project on GitHub: Globalping Repository
Globalping.NET is a game-changer for network diagnostics. With its intuitive API and powerful features, you can run measurements from diverse locations, control probe behavior, and handle caching with ease. Explore the example project in this repository for more scenarios and advanced usages.
Ready to supercharge your diagnostics? Install Globalping.NET today and start exploring the world of network measurements!
This post was last modified on June 15, 2025 22:40
Are you tired of manually running network diagnostics like Ping, Traceroute, or DNS queries? The…
Discover new features in the PSWriteHTML PowerShell module – including New-HTMLInfoCard, improved layout controls with…
Security Identifier (SID) History is a useful mechanism in Active Directory (AD) migrations. It allows…
Today, I made the decision to upgrade my test environment and update the version of…
Have you ever looked at your Active Directory and wondered, "Why do I still have…
Active Directory replication is a critical process that ensures the consistent and up-to-date state of…