Hello all,
First time I used this mailing list so hello all
:)
I program a c++ software to capture network
traffic and analyze it so Winpcap is very useful :)
But i got an issue with the pcap_next_ex
function. I explain:
In my code i analyze the paket as soon as they
arrived and it works fine. (i analyze pkt_data and prints the
packet).
After that, i need to "construct" a Paquet Class
with its packet_data and the number of the packet.
After having my packet, i add it into a list of
packet and here is the issue. When i print my list after for example, 5
packets received, my list seems bugged, as if pkt_data was not
correct.
Here is the code in C++:
//Code located into a thread to sniff while
executing other commands in the main program
while((res = pcap_next_ex( adhandle, &header,
&pkt_data)) >= 0){
if(res
== 0)
{ /*
Timeout elapsed */
//continue;
}
else
{
if (res ==
-1)
{
}
else
{
paquet
=
pkt_data;
Paquet_courant
= new C_Paquet (paquet, cpto);
cpto ++;
Liste_Paque->Add((void*)Paquet_courant);
Synchronize (AfficherListe);
}
type of Liste_Paque is: TList
*Liste_Paque;
AfficherListe is a function to print list of
packets.
When i print mypackets, it works fine for
generally 3 or 4 packets and after, it prints unattended data....
So can u explain me how to store each packet into
a list ?
I need this storage list because i use it in
other capabilities of my program.
Any help will be appreciated.
Thanks a lot.