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 05-09-2008, 01:07 AM   #1
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Rep: Reputation: 33
Is STL time consuming?


hello people,

I am writing some code ( C / C++ languages...) whose work is to capture the packets and search for some strings which are there in the database provided with. I want my code work consistently even on the networks with huge bandwidth where thousands of packets will be arriving at every second. I want it to be extreme robust in nature and also don't want to give up even a time of single clock cycle.

In between I met with a need to maintain some hash structure using which I will be keeping track of all the connections using the four parameters : source port, destination port, source IP, and Destination Ip.




Can any body please tell me if I use the hash_map (or any other STL if any?) will be helpful to me?

or

it will consume more time and better to prepare my own?



I am not sure about which option to choose.





.

Last edited by chakka.lokesh; 05-09-2008 at 01:15 AM.
 
Old 05-09-2008, 03:10 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
The STL is a not always pretty, but it'll save you a lot of time and bugs - if you code you own version of hash_map, you almost certainly will have some bugs which will be a pain to iron out, so why waste the time when you can use a well tested implementation of the same structures?
 
Old 05-09-2008, 05:12 AM   #3
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Perhaps you know this already (and have a reason for not using it), but there is already a C library that you can use to capture packets - pcap.
 
Old 05-11-2008, 11:56 PM   #4
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Original Poster
Rep: Reputation: 33
the information i provided is some thing deviating / a little bit ambiguous. I am using the pcap lib itself for capturing the packets. after capturing, for the sake of keeping track of all the connections, I want to use a hash or a hash like structure. when ever a new packet arrives, I will check to which connection it belongs to and then depending on that information, I have to do some other specific work.

the thing is if I go to hash, the positions of ports and ip addresses changes w.r.t. request and response. If I blindly use the values, I wont be able to pin point the same location.

I will get a packet. I don't know whether it has come from client or from server and also it is not much required.

Last edited by chakka.lokesh; 05-12-2008 at 12:11 AM.
 
  


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
Consuming Memory problem aloneattack Linux - Server 2 04-08-2008 11:07 PM
Nothing too specific or too time consuming, but I made the switch JBailey742 LinuxQuestions.org Member Success Stories 0 06-12-2006 12:28 AM
time consuming loading of Openoffice and endless loading of printing capabilities artjaslo Linux - General 6 08-03-2005 01:30 PM
Silent and low consuming server snop Slackware 4 11-10-2004 05:41 AM
Finding what's consuming my HD space.. Imek Linux - General 3 01-22-2004 03:51 PM

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

All times are GMT -5. The time now is 11:05 PM.

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