www.pudn.com > NetIO.rar > CTNetTraffic.h


 
#if !defined(AFX_MFNETTRAFFIC_H__9CA9C41F_F929_4F26_BD1F_2B5827090494__INCLUDED_) 
#define AFX_MFNETTRAFFIC_H__9CA9C41F_F929_4F26_BD1F_2B5827090494__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#define KB_DIV_BIT 1024.0 
#define MB_DIV_BIT (KB_DIV_BIT * KB_DIV_BIT) 
 
#define SAMPLING_INTERVAL_SECOND 1  
#define SLEEP_INTERVAL (SAMPLING_INTERVAL_SECOND*1000) 
 
#include  
 
 
class CTNetTraffic   
{ 
public: 
	enum TrafficType  
	{ 
		AllTraffic		= 388, 
		IncomingTraffic	= 264, 
		OutGoingTraffic	= 506 
	}; 
 
	void SetTrafficType(int trafficType); 
	DWORD	GetInterfaceTotalTraffic(int index); 
	BOOL	GetNetworkInterfaceName(CString *InterfaceName, int index); 
	int		GetNetworkInterfacesCount(); 
	double	GetTraffic(int interfaceNumber); 
 
	DWORD	GetInterfaceBandwidth(int index); 
 
	// add by lxy 
	int CTNetTraffic::GetFullDesribe(const int intfIndex,char *data); 
 
	CTNetTraffic(); 
	virtual ~CTNetTraffic(); 
private: 
	BOOL		GetInterfaces(); 
	//double		lasttraffic; 
	CStringList Interfaces; 
	CList < DWORD, DWORD &>		Bandwidths; 
	CList < DWORD, DWORD &>		TotalTraffics; 
	int CurrentInterface; 
	int CurrentTrafficType; 
 
	// add by lxy 
	double		lasttrafficAll; 
	double		lasttrafficIn; 
	double		lasttrafficOut; 
 
 
}; 
 
#endif // !defined(AFX_MFNETTRAFFIC_H__9CA9C41F_F929_4F26_BD1F_2B5827090494__INCLUDED_)