LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-19-2006, 09:47 PM   #1
cynthia_thomas
LQ Newbie
 
Registered: Oct 2005
Posts: 28

Rep: Reputation: 15
calculating buffer size


hi,

I am currently working in an intrusion detection system. I want to store the captured packets in a buffer and then process them one by one . Can anybody tell me a formula for allocating the buffer size so the packets won't be dropped due to buffer overflow.

i hope it will depend of the NIC speed and processing speed

thanks and regards
cynthia
 
Old 01-19-2006, 10:49 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Pipe Buffer size traku Linux - Newbie 1 10-23-2009 07:48 AM
Data buffer size MarcReing Programming 7 10-21-2004 12:51 PM
increasing buffer size in memory slice Linux - General 1 09-30-2004 08:10 AM
Controlling pipe buffer size in C shunker Programming 4 01-10-2004 06:52 PM
CD write buffer size rch Linux - General 1 09-26-2003 05:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration