I have two programs. First program(P1) reads packets in a live capture and save them to some files. Each file has 1000 packets.
Second program(P2) open captured files one by one.
Some times, P2 is reading the file that P1 is writing to it. Consequently, P2 returns before reading 1000 packets.
In P2 i use pcap_loop(cap, 1000, (pcap_handler)&myRcvPkt, NULL), but it doesn't work.
what should i do? How can i force P2 to not return and loops until reads 1000 packets?