开发者

Measuring traffic sent and received over Internet

开发者 https://www.devze.com 2023-03-15 00:49 出处:网络
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 inte

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

精彩评论

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