如何测量互联网带宽
我有问题,找不到答案。我想用java测量互联网带宽,但我不知道如何。
如果能得到一些提示那就太好了;我知道我必须打开一个套接字并将其发送到定义的服务器,将其取回然后使用时间。
但我该如何编码呢?
I have a problem and can't find answers. I would like to measure internet bandwidth with java, but I don´t know how.
It would be great to get some hints; I know that I have to open a socket and send it to a defined server, get it back and then use the time.
But how would I code this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我只需下载固定大小的文件即可实现此目的。未经测试,但按照这些思路应该可以正常工作
Well I'd implement this simply by downloading a fixed size file. Not tested, but something along these lines should work just fine
固定任意时间并发送尊重它的数据怎么样?
例如,假设我希望我的服务器将其带宽使用限制为 100Bytes/s。
所以我固定1秒并发送数据,只要它不超过1秒和100字节。
这是一些伪代码来展示我在说什么:
How about fixing an arbitrary amount of time and send the data respecting it?
For example, let's say i want my server to limit it's bandwidth usage to 100Bytes/s.
So i fix 1 second and send the data as long as it does not goes beyond 1 second and 100 Bytes.
Here's some pseudocode to show what I'm talking about: