提问
怎么实现windows2000中 “本地联接 状态”的功能
他可检测到网卡的传送字节数,
他好像是由network monitor driver 实现的
问题点数:100、回复次数:5Top
1 楼xuying()回复于 2002-05-29 15:59:40 得分 0
可以用iphlp API实现。pIfTable中有网卡状态和流入流出字节数的信息。
DWORD GetIfTable(
PMIB_IFTABLE pIfTable, // buffer for interface table
PULONG pdwSize, // size of buffer
BOOL bOrder // sort the table by index?
);
Parameters
pIfTable
[out] Pointer to a buffer that receives the interface table as a MIB_IFTABLE structure.
pdwSize
[in, out] On input, specifies the size of the buffer pointed to by the pIfTable parameter.
On output, if the buffer is not large enough to hold the returned interface table, the function sets this parameter equal to the required buffer size.
bOrder
[in] Specifies whether the returned interface table should be sorted in ascending order by interface index. If this parameter is TRUE, the table is sorted.
Return Values
If the function succeeds, the return value is NO_ERROR.
If the function fails, use FormatMessage to obtain the message string for the returned error.
Top
2 楼tsf_PB(少飞)回复于 2002-05-29 16:05:20 得分 0
其实我是想得到网卡所有交换的数据,不是字节数
Top
3 楼xuying()回复于 2002-05-29 16:16:31 得分 100
那可以用setsockopt设置so_recvall选项,看<windows网络编程>第9章,有例子。
或者用winpcap。
http://winpcap.polito.itTop
4 楼westwf(北星之光)回复于 2002-05-29 16:31:23 得分 0
呵呵。。。。。。。。。
可以自己写个NDIS过滤驱动,微软DDK的NDIS例子部分有现成的。Top
5 楼FY_njim(FLY)回复于 2002-05-29 21:30:24 得分 0
学习Top




