开发者

Detect network connection bandwidth (Android)

开发者 https://www.devze.com 2023-02-17 05:09 出处:网络
I need to determin开发者_开发知识库e programmatically the bandwith of the network connection (not the same as network type (WIFI/3G)). How can i do this? Timing a (short) download?

I need to determin开发者_开发知识库e programmatically the bandwith of the network connection (not the same as network type (WIFI/3G)). How can i do this? Timing a (short) download?

thanks


Step #1: Download something big.

Step #2: Divide the size of the "something big" by the time it took to download to get your bandwidth.


that's for the download and for the upload I used a socket (TCP) and I tried to write an array of bytes in its outputstream so fast as I can and in the end I flush the buffer and devided the number of bytes by the time elapsed to write the whole array in the outputstream.

another alternativ is to try to upload a something big and then devide the "something big" by the time took to upload.

0

精彩评论

暂无评论...
验证码 换一张
取 消