6

As asked, I would like my script to check network bandwidth giving me any idea how fast user can surf through web. Is there any library, which allows me to specify size of package to be send and gives ping time or whatever?

czaaja
  • 119
  • 2
  • 7

1 Answers1

1

This answer mentions a Python implementation of ping that returns the ICMP packet's round-trip time. You can use the improved code from the comment: https://gist.github.com/255009.

But note that since it uses raw sockets, your Python script will need to run as root.

Community
  • 1
  • 1
Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
  • Thank You for an answer. I have figured out that websites which are not loaded properly with my script, use ajax, so using anything from Your post would be just multipling timeout. Anyway I hope it might be useful for someone else. – czaaja Feb 21 '11 at 16:17
  • 1
    Ping can provide the latency, not bandwidth. You can measure the quality of road with `ping` not the width of the road. – Yugal Jindle Mar 03 '12 at 15:33