How to detect Internet connection speed with Java?

前端 未结 3 1068
夕颜
夕颜 2020-12-17 02:40

In my Java app, how do I detect how fast the Internet connection speed is ? For instance, I use AT&T Fast DSL at home, I wonder if there is a way I can write a method th

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-17 03:01

    Time how long it takes you to download a file of known (and sufficiently large) size.

    If it takes you 60s to download 10MB, you have a (10 * 1024 * 8 / 60) Kbps or 1365 Kbps connection.

提交回复
热议问题