There's really no way to guarantee your buffer will never overflow. If we assume 100Mb ethernet, then you'll be getting 12.5MB/sec. If you process less than 12.5MB/sec of data, your buffer will eventually overflow.
That being said, you're not likely to get a full 100Mb/sec of data, at least not for long.
In any case, why are you doing your own capturing? Why not just build your software on top of something like libpcap?
|