Recent

Author Topic: Determine Bandwidth and Latency of (User) Internet Connection  (Read 3258 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Determine Bandwidth and Latency of (User) Internet Connection
« on: September 18, 2017, 10:21:24 am »
hi All,
cross platform how i could determine the bandwidth and latency of the internet connection the user is using?
for latency i want to avoid PING as i understood even in TProcess would need special rights on Unix.

thank you
Lazarus 2.0.2 64b on Debian LXDE 10

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Determine Bandwidth and Latency of (User) Internet Connection
« Reply #1 on: September 18, 2017, 10:57:32 am »
Bandwidth is a bit difficult/impossible w/o moving files hence and forth (that's how speedtest.net and the likes do it, using a browser cache/temp/flash datastore), but latency is easy to measure with any protocol:
just time the interval between request and response. Preferably a couple of times.

Note that if you want to measure bandwidth yourself, be careful not to measure your own bandwidth:

E,g, I have 100/30 but at work I have 500/500. I'll end up measuring myself.
« Last Edit: September 18, 2017, 11:09:00 am by Thaddy »
Specialize a type, not a var.

benohb

  • Full Member
  • ***
  • Posts: 213
Re: Determine Bandwidth and Latency of (User) Internet Connection
« Reply #2 on: September 18, 2017, 11:22:26 am »
Users On LAN ?? or Users in same PC  %)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Determine Bandwidth and Latency of (User) Internet Connection
« Reply #3 on: September 18, 2017, 11:35:51 am »
users on internet using my app.
Lazarus 2.0.2 64b on Debian LXDE 10

benohb

  • Full Member
  • ***
  • Posts: 213
Re: Determine Bandwidth and Latency of (User) Internet Connection
« Reply #4 on: September 18, 2017, 04:59:51 pm »
Quote
users on internet using my app.

Users who using your app in their device ????

please explain %)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Determine Bandwidth and Latency of (User) Internet Connection
« Reply #5 on: September 18, 2017, 05:33:41 pm »
the application is installed in a desktop computer and connects to a server in internet to download some files.
i need to indicate to the user of the application if their internet connection works fine, basically:
a. has internet
b. bandwidth (poor, good, excellent)
c. latency (poor, good, excellent)

for a. i will make a GET to a server to receive some XML
if a. then:
for c. i am calculating how much time it took to get a.
for b. i am trying to find a web service that sends a big XML so can compute some kind of bandwidth. i do not want to download a file for this due to different policies on user computers although it looks contradictory with the application scope

Lazarus 2.0.2 64b on Debian LXDE 10

Noodly

  • Jr. Member
  • **
  • Posts: 70
Re: Determine Bandwidth and Latency of (User) Internet Connection
« Reply #6 on: September 18, 2017, 08:32:44 pm »
the application is installed in a desktop computer and connects to a server in internet to download some files.
i need to indicate to the user of the application if their internet connection works fine, basically:
a. has internet
b. bandwidth (poor, good, excellent)
c. latency (poor, good, excellent)

for a. i will make a GET to a server to receive some XML
if a. then:
for c. i am calculating how much time it took to get a.
for b. i am trying to find a web service that sends a big XML so can compute some kind of bandwidth. i do not want to download a file for this due to different policies on user computers although it looks contradictory with the application scope

If your app itself has sufficient rights when installed, you could try and incorporate the Synapse library and use it's ping functionality for a) and c).

For b), relying on a third party server could lead to incorrect measurements in future if they introduce throttling when busy or add/remove compression. Of course all this won't matter so much if your thresholds for poor, good, excellent are spread widely in the first place.
Windows 10 Home, Lazarus 2.02 (svn 60954), FPC 3.04

Trenatos

  • Hero Member
  • *****
  • Posts: 535
    • MarcusFernstrom.com
Re: Determine Bandwidth and Latency of (User) Internet Connection
« Reply #7 on: September 18, 2017, 08:43:45 pm »
Bandwidth would be compared between a preset and current, as in "You've used 500mb out of 1gb available" type of thing.

Latency is easy, just ping the server you're downloading from and record the time / 2, or wrap the system ping/trace info and use that.

 

TinyPortal © 2005-2018