How to store multiple received packet in a List<>

May 22, 2013 at 1:31 PM
I am struggling trying to store packets into a list.
I have a program that collects the packets and dumps them to file, however i am losing packets because of the stop start nature of the writing to file bit.
my solution is to store the packets in a list or another container then pop the packets i want to write to file from the list while the list is still being filled by the new captured packets from the network device.

1st: is this even possible?

2nd: how do you do it ? haha

note: due to the nature of my work I cannot share the code i currently have, but it will be scrapped this next stage is figured out anyway.

Thanks in advance.
Coordinator
May 31, 2013 at 7:42 AM
Seems like you need a standard multi threaded program.
Maybe a Producer - Consumer design would work out for you.
You can check out online, there are many examples for such a design, probably much better than any I can give you since they don't require any Pcap.Net understanding.