开发者

Measuring traffic sent and received over Internet

How to measure the number of bytes sent and received while using the internet from VB.NET 开发者_开发问答2010 ?


Here's an example of code that grabs the number of bytes received by the first IPv4 interface .(I set a label to the number, but of course you can do whatever with the number.)

Dim ipv4Stats As System.Net.NetworkInformation.IPv4InterfaceStatistics

ipv4Stats = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0).GetIPv4Statistics
Label1.Text = ipv4Stats.BytesReceived.ToString

I guess if you wanted it to automagically update or something, you could tie it to a timer or something.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜