How to Measuring Download and Upload Speed within a .NET MAUI Blazor Application?

NIRANJAN CHIGULLA 5 Reputation points
2024-04-04T07:50:06.14+00:00

I'm working on a .NET MAUI Blazor application and I need to implement functionality to measure both download and upload speeds within the application. I want to display these speeds to the user for network performance monitoring purposes.

Could someone provide guidance or examples on how to achieve this within a .NET MAUI Blazor application? Specifically, I'm looking for:

1.Methods or APIs to accurately measure download and upload speeds.

2.Best practices or considerations for handling network speed measurements in a .Net Maui Blazor application.

Any help or pointers in the right direction would be greatly appreciated!

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,578 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,493 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 65,211 Reputation points
    2024-04-05T16:16:06.6133333+00:00

    its pretty simple.

    first setup a test server(s) that you can call for the speed test. professional speed testers will have lots of server in different geographic locations, and will use geolocation to pick/display close servers.

    for upload speed test you send a packet to the test server, and the server sends a response. using wall clock time, you time the response.

    for download, you request a packet from the test server and measure time to receive. there is no need to save the data.

    you can measure latency by timing how long the tcp connection to the test server takes.

    note: if you expected to get network performance for non test requests, than that not doable. If you created a proxy or vpn service you could get performance data. your proxy/vpn code measure traffic time, by wrapping the requests with a protocol that measured the packet times. This is beyond the scope of a Maui app.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.