全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:8184
推到 Plurk!
推到 Facebook!

網路流量統計

 
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-07-20 23:59:43 IP:61.224.xxx.xxx 未訂閱
主要使用 GetIfTable 這個 API 來取得每一個介面的流量資料。 不想下載可以參考以下的原始碼。    ■ Unit1.cpp
//---------------------------------------------------------------------------
// 網路流量統計    by dllee http://dllee.ktop.com.tw
// <2003-07-20>
// 參考資料
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getiftable.asp
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/mib_iftable.asp
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/mib_ifrow.asp
//---------------------------------------------------------------------------    #include 
#pragma hdrstop    #include "iphlpapi.h"
#include "Unit1.h"    #define _MAX_TABLE_ 8
typedef struct _MIB_IFTABLE8 {
  DWORD dwNumEntries;
  MIB_IFROW table[_MAX_TABLE_];
} MIB_IFTABLE8, *PMIB_IFTABLE8;    //----------------------------------------------------------------------------//
#pragma package(smart_init)
#pragma resource "*.dfm"    TForm1 *Form1;
//----------------------------------------------------------------------------//
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  List[0]=new TListBox(TabSheet1);
  List[0]->Parent=TabSheet1;
  List[0]->Align=alClient;
  List[0]->Name="ListBox1";
  List[1]=new TListBox(TabSheet2);
  List[1]->Parent=TabSheet2;
  List[1]->Align=alClient;
  List[1]->Name="ListBox2";
  List[2]=new TListBox(TabSheet3);
  List[2]->Parent=TabSheet3;
  List[2]->Align=alClient;
  List[2]->Name="ListBox3";
  List[3]=new TListBox(TabSheet4);
  List[3]->Parent=TabSheet4;
  List[3]->Align=alClient;
  List[3]->Name="ListBox4";
  List[4]=new TListBox(TabSheet5);
  List[4]->Parent=TabSheet5;
  List[4]->Align=alClient;
  List[4]->Name="ListBox5";
  List[5]=new TListBox(TabSheet6);
  List[5]->Parent=TabSheet6;
  List[5]->Align=alClient;
  List[5]->Name="ListBox6";
  List[6]=new TListBox(TabSheet7);
  List[6]->Parent=TabSheet7;
  List[6]->Align=alClient;
  List[6]->Name="ListBox7";
  List[7]=new TListBox(TabSheet8);
  List[7]->Parent=TabSheet8;
  List[7]->Align=alClient;
  List[7]->Name="ListBox8";      Tab[0]=TabSheet1;
  Tab[1]=TabSheet2;
  Tab[2]=TabSheet3;
  Tab[3]=TabSheet4;
  Tab[4]=TabSheet5;
  Tab[5]=TabSheet6;
  Tab[6]=TabSheet7;
  Tab[7]=TabSheet8;      memset(IOdata, 0, sizeof(NETIO)*8);
  Button1Click(Button1);
}
//----------------------------------------------------------------------------//    void __fastcall TForm1::Button1Click(TObject *Sender)
{
  MIB_IFTABLE8 MIB;
  DWORD Size=sizeof(MIB);
  DWORD Result=GetIfTable((_MIB_IFTABLE*)&MIB,&Size,CheckBox1->Checked);
  if(Result==ERROR_INSUFFICIENT_BUFFER)
  {
    MIB.dwNumEntries=_MAX_TABLE_;
    Result=NO_ERROR;
  }
  if(Result==NO_ERROR)
  {
    int i;
    for(i=0;iClear();
      Tab[i]->TabVisible=true;
      // List[i]->Items->Add("Name = " String(WideString((wchar_t*)MIB.table[i].wszName)));
      // List[i]->Items->Add("PhysAddrLen = " String(MIB.table[i].dwPhysAddrLen));
      AnsiString asMAC=EmptyStr;
      for(int j=0;jItems->Add("PhysAddr = " asMAC);          // List[i]->Items->Add("DescrLen = " String(MIB.table[i].dwDescrLen));
      asMAC=String((char*)MIB.table[i].bDescr);
      List[i]->Items->Add("Descr = " asMAC.SetLength(MIB.table[i].dwDescrLen));          List[i]->Items->Add("Index = " String(MIB.table[i].dwIndex));
      List[i]->Items->Add("Type = " String(MIB.table[i].dwType));
      List[i]->Items->Add("Mtu = " String(MIB.table[i].dwMtu));
      List[i]->Items->Add("Speed = " String(MIB.table[i].dwSpeed));
      List[i]->Items->Add("AdminStatus = " String(MIB.table[i].dwAdminStatus));
      List[i]->Items->Add("OperStatus = " String(MIB.table[i].dwOperStatus));
      List[i]->Items->Add("LastChange = " String(MIB.table[i].dwLastChange));
      List[i]->Items->Add("InOctets = " String(MIB.table[i].dwInOctets));
      List[i]->Items->Add("InUcastPkts = " String(MIB.table[i].dwInUcastPkts));
      List[i]->Items->Add("InNUcastPkts = " String(MIB.table[i].dwInNUcastPkts));
      List[i]->Items->Add("InDiscards = " String(MIB.table[i].dwInDiscards));
      List[i]->Items->Add("InErrors = " String(MIB.table[i].dwInErrors));
      List[i]->Items->Add("InUnknownProtos = " String(MIB.table[i].dwInUnknownProtos));
      List[i]->Items->Add("OutOctets = " String(MIB.table[i].dwOutOctets));
      List[i]->Items->Add("OutUcastPkts = " String(MIB.table[i].dwOutUcastPkts));
      List[i]->Items->Add("OutNUcastPkts = " String(MIB.table[i].dwOutNUcastPkts));
      List[i]->Items->Add("OutDiscards = " String(MIB.table[i].dwOutDiscards));
      List[i]->Items->Add("OutErrors = " String(MIB.table[i].dwOutErrors));
      List[i]->Items->Add("OutQLen = " String(MIB.table[i].dwOutQLen));          IOdata[i].dwInOctetsPerSec=MIB.table[i].dwInOctets-IOdata[i].dwLastInOctets;
      if(IOdata[i].dwLastInOctets!=0 && IOdata[i].dwMaxInOctetsPerSec < IOdata[i].dwInOctetsPerSec)
        IOdata[i].dwMaxInOctetsPerSec=IOdata[i].dwInOctetsPerSec;
      IOdata[i].dwLastInOctets=MIB.table[i].dwInOctets;          IOdata[i].dwOutOctetsPerSec=MIB.table[i].dwOutOctets-IOdata[i].dwLastOutOctets;
      if(IOdata[i].dwLastOutOctets!=0 && IOdata[i].dwMaxOutOctetsPerSec < IOdata[i].dwOutOctetsPerSec)
        IOdata[i].dwMaxOutOctetsPerSec=IOdata[i].dwOutOctetsPerSec;
      IOdata[i].dwLastOutOctets=MIB.table[i].dwOutOctets;          List[i]->Items->Add("");
      List[i]->Items->Add("-----");
      List[i]->Items->Add("");
      List[i]->Items->Add("InOctetsPerSec = " String(IOdata[i].dwInOctetsPerSec));
      List[i]->Items->Add("OutOctetsPerSec = " String(IOdata[i].dwOutOctetsPerSec));
      // List[i]->Items->Add("LastInOctets = " String(IOdata[i].dwLastInOctets));
      // List[i]->Items->Add("LastOutOctets = " String(IOdata[i].dwLastOutOctets));
      List[i]->Items->Add("MaxInOctetsPerSec = " String(IOdata[i].dwMaxInOctetsPerSec));
      List[i]->Items->Add("MaxOutOctetsPerSec = " String(IOdata[i].dwMaxOutOctetsPerSec));
    }
    for(;i<_MAX_TABLE_;i  )
    {
      List[i]->Clear();
      Tab[i]->TabVisible=false;
      List[i]->Items->Add("--");
    }
  }
  else
  {
    ShowMessage("Sorry Your System Do Not Support...");
  }
}
//----------------------------------------------------------------------------//    void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
  Button1Click(Button1);
}
//----------------------------------------------------------------------------//
void __fastcall TForm1::Button2Click(TObject *Sender)
{
  Close();
}
//----------------------------------------------------------------------------//
void __fastcall TForm1::CheckBox1Click(TObject *Sender)
{
  Button1Click(Button1);
  Button3Click(Button3);
}
//----------------------------------------------------------------------------//    void __fastcall TForm1::Button3Click(TObject *Sender)
{
    for(int i=0;i<_MAX_TABLE_;i  )
    {
      IOdata[i].dwMaxInOctetsPerSec=0;
      IOdata[i].dwMaxOutOctetsPerSec=0;
    }
}
//----------------------------------------------------------------------------//
■ Unit1.h
//---------------------------------------------------------------------------    #ifndef Unit1H
#define Unit1H
//----------------------------------------------------------------------------//
#include 
#include 
#include 
#include <Forms.hpp>
#include 
#include 
//----------------------------------------------------------------------------//
typedef struct _NETIO {
  DWORD dwInOctetsPerSec;
  DWORD dwOutOctetsPerSec;
  DWORD dwLastInOctets;
  DWORD dwLastOutOctets;
  DWORD dwMaxInOctetsPerSec;
  DWORD dwMaxOutOctetsPerSec;
} NETIO, *PNETIO;    class TForm1 : public TForm
{
__published:        // IDE-managed Components
  TButton *Button1;
  TPageControl *PageControl1;
  TTabSheet *TabSheet1;
  TTabSheet *TabSheet2;
  TTabSheet *TabSheet3;
  TTabSheet *TabSheet4;
  TTabSheet *TabSheet5;
  TTabSheet *TabSheet6;
  TTabSheet *TabSheet7;
  TTabSheet *TabSheet8;
  TTimer *Timer1;
  TButton *Button2;
  TCheckBox *CheckBox1;
  TButton *Button3;
  void __fastcall Button1Click(TObject *Sender);
  void __fastcall Timer1Timer(TObject *Sender);
  void __fastcall Button2Click(TObject *Sender);
  void __fastcall CheckBox1Click(TObject *Sender);
  void __fastcall Button3Click(TObject *Sender);
private:        // User declarations
  TListBox *List[8];
  TTabSheet *Tab[8];
  NETIO     IOdata[8];
public:                // User declarations
  __fastcall TForm1(TComponent* Owner);
};
//----------------------------------------------------------------------------//
extern PACKAGE TForm1 *Form1;
//----------------------------------------------------------------------------//
#endif
{2003-07-22} 新增所有介面最大值統計 {2003-07-22} 新增自動調整統計最大值 沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell.... 發表人 - dllee 於 2003/07/22 09:35:18
------
http://www.ViewMove.com
附加檔案:34322_NetIO.zip
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-07-22 09:08:36 IP:61.224.xxx.xxx 未訂閱
{2003-07-22} 新增所有介面最大值統計 {2003-07-22} 新增自動調整統計最大值    我實作這個小工具,其實是為了 geOShell 中的 geOStatPlus 這個插件所作的練習,主要是希望能夠得到網路卡的流量。但使用 GetIfTable 只能得到每一個通訊介面的流量,所以在此更新版中,加入統計各通訊介面最大值的功能。如果,您知道如何直接取得單一網路卡或單機所有網路卡的流量,希望給點指教或提示,先謝囉。    以下是新版的 code    ■ Unit1.cpp
//---------------------------------------------------------------------------
// 網路流量統計    by dllee http://dllee.ktop.com.tw
// <2003-07-20>
// 參考資料
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getiftable.asp
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/mib_iftable.asp
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/mib_ifrow.asp
//
// 網路流量統計    by dllee http://dllee.ktop.com.tw
// <2003-07-22> Add a Maximum Values for all net interface I/O
// <2003-07-22> Add Auto Maximum Scale Down Feature
//---------------------------------------------------------------------------    #include 
#pragma hdrstop    #include "iphlpapi.h"
#include "Unit1.h"    #define _MAX_SCALEDOWN_COUNT_ 10
#define _MAX_TABLE_ 8
typedef struct _MIB_IFTABLE8 {
  DWORD dwNumEntries;
  MIB_IFROW table[_MAX_TABLE_];
} MIB_IFTABLE8, *PMIB_IFTABLE8;    //----------------------------------------------------------------------------//
#pragma package(smart_init)
#pragma resource "*.dfm"    TForm1 *Form1;
//----------------------------------------------------------------------------//
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  List[0]=new TListBox(TabSheet1);
  List[0]->Parent=TabSheet1;
  List[0]->Align=alClient;
  List[0]->Name="ListBox1";
  List[1]=new TListBox(TabSheet2);
  List[1]->Parent=TabSheet2;
  List[1]->Align=alClient;
  List[1]->Name="ListBox2";
  List[2]=new TListBox(TabSheet3);
  List[2]->Parent=TabSheet3;
  List[2]->Align=alClient;
  List[2]->Name="ListBox3";
  List[3]=new TListBox(TabSheet4);
  List[3]->Parent=TabSheet4;
  List[3]->Align=alClient;
  List[3]->Name="ListBox4";
  List[4]=new TListBox(TabSheet5);
  List[4]->Parent=TabSheet5;
  List[4]->Align=alClient;
  List[4]->Name="ListBox5";
  List[5]=new TListBox(TabSheet6);
  List[5]->Parent=TabSheet6;
  List[5]->Align=alClient;
  List[5]->Name="ListBox6";
  List[6]=new TListBox(TabSheet7);
  List[6]->Parent=TabSheet7;
  List[6]->Align=alClient;
  List[6]->Name="ListBox7";
  List[7]=new TListBox(TabSheet8);
  List[7]->Parent=TabSheet8;
  List[7]->Align=alClient;
  List[7]->Name="ListBox8";      Tab[0]=TabSheet1;
  Tab[1]=TabSheet2;
  Tab[2]=TabSheet3;
  Tab[3]=TabSheet4;
  Tab[4]=TabSheet5;
  Tab[5]=TabSheet6;
  Tab[6]=TabSheet7;
  Tab[7]=TabSheet8;      memset(IOdata, 0, sizeof(NETIO)*8);
  memset(&MAXdata, 0, sizeof(NETIO));
  Button1Click(Button1);
}
//----------------------------------------------------------------------------//    void __fastcall TForm1::Button1Click(TObject *Sender)
{
  static int iCount=0;
  MIB_IFTABLE8 MIB;
  DWORD Size=sizeof(MIB);
  DWORD Result=GetIfTable((_MIB_IFTABLE*)&MIB,&Size,CheckBox1->Checked);
  if(Result==ERROR_INSUFFICIENT_BUFFER)
  {
    MIB.dwNumEntries=_MAX_TABLE_;
    Result=NO_ERROR;
  }
  if(Result==NO_ERROR)
  {
    ListBox->Items->BeginUpdate();
    ListBox->Clear();        MAXdata.dwInOctetsPerSec=0;
    MAXdata.dwOutOctetsPerSec=0;
    MAXdata.dwMaxInOctetsPerSec=0;
    MAXdata.dwMaxOutOctetsPerSec=0;        int i;
    for(i=0;iItems->BeginUpdate();
      List[i]->Clear();
      Tab[i]->TabVisible=true;
      // List[i]->Items->Add("Name = " String(WideString((wchar_t*)MIB.table[i].wszName)));
      // List[i]->Items->Add("PhysAddrLen = " String(MIB.table[i].dwPhysAddrLen));
      AnsiString asMAC=EmptyStr;
      for(int j=0;jItems->Add("PhysAddr = " asMAC);          // List[i]->Items->Add("DescrLen = " String(MIB.table[i].dwDescrLen));
      asMAC=String((char*)MIB.table[i].bDescr);
      List[i]->Items->Add("Descr = " asMAC.SetLength(MIB.table[i].dwDescrLen));          List[i]->Items->Add("Index = " String(MIB.table[i].dwIndex));
      List[i]->Items->Add("Type = " String(MIB.table[i].dwType));
      List[i]->Items->Add("Mtu = " String(MIB.table[i].dwMtu));
      List[i]->Items->Add("Speed = " String(MIB.table[i].dwSpeed));
      List[i]->Items->Add("AdminStatus = " String(MIB.table[i].dwAdminStatus));
      List[i]->Items->Add("OperStatus = " String(MIB.table[i].dwOperStatus));
      List[i]->Items->Add("LastChange = " String(MIB.table[i].dwLastChange));
      List[i]->Items->Add("InOctets = " String(MIB.table[i].dwInOctets));
      List[i]->Items->Add("InUcastPkts = " String(MIB.table[i].dwInUcastPkts));
      List[i]->Items->Add("InNUcastPkts = " String(MIB.table[i].dwInNUcastPkts));
      List[i]->Items->Add("InDiscards = " String(MIB.table[i].dwInDiscards));
      List[i]->Items->Add("InErrors = " String(MIB.table[i].dwInErrors));
      List[i]->Items->Add("InUnknownProtos = " String(MIB.table[i].dwInUnknownProtos));
      List[i]->Items->Add("OutOctets = " String(MIB.table[i].dwOutOctets));
      List[i]->Items->Add("OutUcastPkts = " String(MIB.table[i].dwOutUcastPkts));
      List[i]->Items->Add("OutNUcastPkts = " String(MIB.table[i].dwOutNUcastPkts));
      List[i]->Items->Add("OutDiscards = " String(MIB.table[i].dwOutDiscards));
      List[i]->Items->Add("OutErrors = " String(MIB.table[i].dwOutErrors));
      List[i]->Items->Add("OutQLen = " String(MIB.table[i].dwOutQLen));          IOdata[i].dwInOctetsPerSec=MIB.table[i].dwInOctets-IOdata[i].dwLastInOctets;
      if(IOdata[i].dwLastInOctets!=0 && IOdata[i].dwMaxInOctetsPerSec < IOdata[i].dwInOctetsPerSec)
        IOdata[i].dwMaxInOctetsPerSec=IOdata[i].dwInOctetsPerSec;
      IOdata[i].dwLastInOctets=MIB.table[i].dwInOctets;          IOdata[i].dwOutOctetsPerSec=MIB.table[i].dwOutOctets-IOdata[i].dwLastOutOctets;
      if(IOdata[i].dwLastOutOctets!=0 && IOdata[i].dwMaxOutOctetsPerSec < IOdata[i].dwOutOctetsPerSec)
        IOdata[i].dwMaxOutOctetsPerSec=IOdata[i].dwOutOctetsPerSec;
      IOdata[i].dwLastOutOctets=MIB.table[i].dwOutOctets;          // Auto Scale down the Maximum Value
      if(IOdata[i].dwInOctetsPerSec != 0 || IOdata[i].dwOutOctetsPerSec != 0 )
        IOdata[i].dwZeroCount=0;
      else
      {
        if(  IOdata[i].dwZeroCount > _MAX_SCALEDOWN_COUNT_)
        {
          IOdata[i].dwZeroCount=0;
          IOdata[i].dwMaxOutOctetsPerSec >>= 1;
          IOdata[i].dwMaxInOctetsPerSec >>= 1;
        }
      }          List[i]->Items->Add("");
      List[i]->Items->Add("-----");
      List[i]->Items->Add("");
      List[i]->Items->Add("InOctetsPerSec = " String(IOdata[i].dwInOctetsPerSec));
      List[i]->Items->Add("OutOctetsPerSec = " String(IOdata[i].dwOutOctetsPerSec));
      // List[i]->Items->Add("LastInOctets = " String(IOdata[i].dwLastInOctets));
      // List[i]->Items->Add("LastOutOctets = " String(IOdata[i].dwLastOutOctets));
      List[i]->Items->Add("MaxInOctetsPerSec = " String(IOdata[i].dwMaxInOctetsPerSec));
      List[i]->Items->Add("MaxOutOctetsPerSec = " String(IOdata[i].dwMaxOutOctetsPerSec));          ListBox->Items->Add("Descr = " asMAC.SetLength(MIB.table[i].dwDescrLen));
      ListBox->Items->Add("InOctetsPerSec = " String(IOdata[i].dwInOctetsPerSec));
      ListBox->Items->Add("OutOctetsPerSec = " String(IOdata[i].dwOutOctetsPerSec));
      ListBox->Items->Add("MaxInOctetsPerSec = " String(IOdata[i].dwMaxInOctetsPerSec));
      ListBox->Items->Add("MaxOutOctetsPerSec = " String(IOdata[i].dwMaxOutOctetsPerSec));
      ListBox->Items->Add("");          if(IOdata[i].dwInOctetsPerSec > MAXdata.dwInOctetsPerSec)
        MAXdata.dwInOctetsPerSec = IOdata[i].dwInOctetsPerSec;
      if(IOdata[i].dwOutOctetsPerSec > MAXdata.dwOutOctetsPerSec)
        MAXdata.dwOutOctetsPerSec = IOdata[i].dwOutOctetsPerSec;
      if(IOdata[i].dwMaxInOctetsPerSec > MAXdata.dwMaxInOctetsPerSec)
        MAXdata.dwMaxInOctetsPerSec = IOdata[i].dwMaxInOctetsPerSec;
      if(IOdata[i].dwMaxOutOctetsPerSec > MAXdata.dwMaxOutOctetsPerSec)
        MAXdata.dwMaxOutOctetsPerSec = IOdata[i].dwMaxOutOctetsPerSec;          List[i]->Items->EndUpdate();
    }        for(;i<_MAX_TABLE_;i  )
    {
      List[i]->Clear();
      Tab[i]->TabVisible=false;
      List[i]->Items->Add("--");
    }        ListBox->Items->Add("Descr = Maximum data of all net interfaces");
    ListBox->Items->Add("Max InOctetsPerSec = " String(MAXdata.dwInOctetsPerSec));
    ListBox->Items->Add("Max OutOctetsPerSec = " String(MAXdata.dwOutOctetsPerSec));
    ListBox->Items->Add("Max MaxInOctetsPerSec = " String(MAXdata.dwMaxInOctetsPerSec));
    ListBox->Items->Add("Max MaxOutOctetsPerSec = " String(MAXdata.dwMaxOutOctetsPerSec));
    ListBox->Items->EndUpdate();
  }
  else
  {
    ShowMessage("Sorry Your System Do Not Support...");
  }
}
//----------------------------------------------------------------------------//    void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
  Button1Click(Button1);
}
//----------------------------------------------------------------------------//
void __fastcall TForm1::Button2Click(TObject *Sender)
{
  Close();
}
//----------------------------------------------------------------------------//
void __fastcall TForm1::CheckBox1Click(TObject *Sender)
{
  Button1Click(Button1);
  Button3Click(Button3);
}
//----------------------------------------------------------------------------//    void __fastcall TForm1::Button3Click(TObject *Sender)
{
    for(int i=0;i<_MAX_TABLE_;i  )
    {
      IOdata[i].dwMaxInOctetsPerSec=0;
      IOdata[i].dwMaxOutOctetsPerSec=0;
    }
    MAXdata.dwMaxInOctetsPerSec=0;
    MAXdata.dwMaxOutOctetsPerSec=0;
}
//----------------------------------------------------------------------------//
■ Unit1.h
//---------------------------------------------------------------------------    #ifndef Unit1H
#define Unit1H
//----------------------------------------------------------------------------//
#include 
#include 
#include 
#include <Forms.hpp>
#include 
#include 
//----------------------------------------------------------------------------//
typedef struct _NETIO {
  DWORD dwInOctetsPerSec;
  DWORD dwOutOctetsPerSec;
  DWORD dwLastInOctets;
  DWORD dwLastOutOctets;
  DWORD dwMaxInOctetsPerSec;
  DWORD dwMaxOutOctetsPerSec;
  DWORD dwZeroCount;
} NETIO, *PNETIO;    class TForm1 : public TForm
{
__published:        // IDE-managed Components
  TButton *Button1;
  TPageControl *PageControl1;
  TTabSheet *TabSheet1;
  TTabSheet *TabSheet2;
  TTabSheet *TabSheet3;
  TTabSheet *TabSheet4;
  TTabSheet *TabSheet5;
  TTabSheet *TabSheet6;
  TTabSheet *TabSheet7;
  TTabSheet *TabSheet8;
  TTimer *Timer1;
  TButton *Button2;
  TCheckBox *CheckBox1;
  TButton *Button3;
  TTabSheet *TabSheet9;
  TListBox *ListBox;
  void __fastcall Button1Click(TObject *Sender);
  void __fastcall Timer1Timer(TObject *Sender);
  void __fastcall Button2Click(TObject *Sender);
  void __fastcall CheckBox1Click(TObject *Sender);
  void __fastcall Button3Click(TObject *Sender);
private:        // User declarations
  TListBox *List[8];
  TTabSheet *Tab[8];
  NETIO     IOdata[8];
  NETIO     MAXdata;
public:                // User declarations
  __fastcall TForm1(TComponent* Owner);
};
//----------------------------------------------------------------------------//
extern PACKAGE TForm1 *Form1;
//----------------------------------------------------------------------------//
#endif
沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell.... 發表人 - dllee 於 2003/07/22 09:36:39
------
http://www.ViewMove.com
ohyajack
一般會員


發表:11
回覆:12
積分:4
註冊:2005-02-20

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-06-12 14:39:26 IP:140.127.xxx.xxx 未訂閱
問一下很久以前的文章 :p (快2年前了... @_@) dllee您好: 想請教一下MIB_IFROW底下的dwInOctets和dwOutOctets他們的單位是什麼阿 @@ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/html/wcesdkrmib_ifrow.asp 我看msdn上的說明是指octets (查了一下應該是指byte) 不過實際上寫出來的數據好像不太一樣 還是我誤會他的意思了 @_@ 又來麻煩您了 ^^
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-06-12 21:42:39 IP:211.76.xxx.xxx 未訂閱
octets 應該就是 byte, 但它不用 byte 而用 octet  我想,應該是還有其他控制用的資料,如封包頭尾、TCP/IP 資料等等, 而不只是實際上傳輸的資料內容。 就像 RS232 傳輸,也有 Start Bit, Stop Bit 等等,含 8 BIT DATA, 至少要傳 10bits 才能完成 1 byte 的傳輸。 Octets 應該也是如此,如果有正在下載資料時,可以用下載資料軟體的 每秒傳多少 byte 與此函式每秒傳多少 Octet 比較,應該此函式會回報 較高的速率,因為它包含那些非資料的傳輸。 對我來說,這個數值本來就只是參考,即時查看它,有時是可以了解到底 是否有後門程式在亂傳資料...    C# 初學者請多指教  < href="http://free.greenworld.com.tw/~dllee/" target="blank">吃軟也吃硬 dllee.ktop.com.tw StatPlus 系統資源監測器 @ KTOP OpenPLC - IEC 61131-3
------
http://www.ViewMove.com
系統時間:2024-12-24 0:41:21
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!