Текущий архив: 2002.04.18;
Скачать: CL | DM;
Вниз
Сетевой трафик Найти похожие ветки
← →
serge_sss (2002-01-27 11:02) [0]Можно где-нибудь найти исходник проги, для учета сетевого трафика
на одной или нескольких машинах
← →
VuDZ (2002-01-27 19:25) [1]вот. основное - выделю:
// tests.cpp : Defines the entry point for the console application.
//
#define UNICODE
#include "windows.h"
#include <conio.h>
#include <Iphlpapi.h>
#include <iostream.h>
#include <stdio.h>
#include <lm.h>
int main(int argc, char* argv[], char* env[])
{
IP_INTERFACE_INFO * prebuf = new IP_INTERFACE_INFO;
DWORD rec = sizeof (IP_INTERFACE_INFO);
if ( GetInterfaceInfo(prebuf, &rec) == ERROR_INSUFFICIENT_BUFFER)
{
delete (prebuf);
prebuf = (IP_INTERFACE_INFO *)new char[rec];
if (GetInterfaceInfo(prebuf, &rec) != NO_ERROR)
return -1;
}
MIB_IFROW * buf = new MIB_IFROW;
buf->dwIndex = prebuf->Adapter->Index;
if ( GetIfEntry(buf) != NO_ERROR)
return -1;
cout << "Stats:\n";
cout << "number of incoming packets\n";
cout << " that were discarded even though they did not have errors " << buf->dwInDiscards << endl;
cout << " that were discarded because of errors " << buf->dwInErrors << endl;
cout << "number of outgoing packets\n";
cout << " that were discarded even though they did not have errors " << buf->dwOutDiscards << endl;
cout << " that were discarded because of errors " << buf->dwOutErrors << endl;
cout << "the Maximum Transmission Unit (MTU) " << buf->dwMtu << endl;
cout << "speed of the interface in bits per second " << buf->dwSpeed << endl;
cout << "incoming:\n";
cout << " number of octets of data received through this interface " << buf->dwInOctets << endl;
cout << " number of unicast packets received through this interface " << buf->dwInUcastPkts << endl;
cout << " non-unicast packets received through this interface " << buf->dwInNUcastPkts << endl;
cout << " number of incoming packets with unknown protocol " << buf->dwInUnknownProtos << endl;
cout << "outgoing:\n";
cout << " number of octets of data sent through this interface " << buf->dwOutOctets << endl;
cout << " number of unicast packets sent through this interface " << buf->dwOutUcastPkts << endl;
cout << " number of non-unicast packets sent through this interface " << buf->dwOutNUcastPkts << endl;
cout << endl << "output queue length " << buf->dwOutQLen << endl;
getch();
return 0;
}
← →
Vks (2002-02-05 15:49) [2]господа, переведите с идиотского на русский, что это С - я понял, и куда это девать?????
← →
VuDZ (2002-02-05 15:54) [3]Vks
ты чисто канкретно что ли?
если ты не могёшь допереть куды это вставлять, то RIP...
PS я фигею, дорогая редакция...
PPS на асме подойдёт вариант? :D
Страницы: 1 вся ветка
Текущий архив: 2002.04.18;
Скачать: CL | DM;
Память: 0.45 MB
Время: 0.005 c