Re: [問題] web的網路流量統計
※ 引述《taoko (春秋兩不沾)》之銘言:
: as title, 我想寫一個像計中可以統計每天的流出與流進的位元組
: (也就像左下角工具列的區路網路中的位元組統計)
: 我知道應該要用IPGlobalStatistics 的類別庫
: 可是詳細的function請問是什麼?
: 感激不盡
using System.Net.NetworkInformation;
public static void ShowInboundIPStatistics()
{
IPGlobalProperties properties =
IPGlobalProperties.GetIPGlobalProperties();
IPGlobalStatistics ipstat = properties.GetIPv4GlobalStatistics();
Console.WriteLine(" Inbound Packet Data:");
Console.WriteLine(" Received ............................ : {0}",
ipstat.ReceivedPackets);
Console.WriteLine(" Forwarded ........................... : {0}",
ipstat.ReceivedPacketsForwarded);
Console.WriteLine(" Delivered ........................... : {0}",
ipstat.ReceivedPacketsDelivered);
Console.WriteLine(" Discarded ........................... : {0}",
ipstat.ReceivedPacketsDiscarded);
}
--
這是MSDN提供的sample code..
我直接用你給的 IPGlobalStatistics 馬上就找到答案了
建議你下次可以自己先試著找找看
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.119.232.160
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章
7
20