User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 5 Sep 2006, 06:10   #1
Doorsdown
Aria's TeddyBear :p
 
Doorsdown's Avatar
 
Join Date: Apr 2002
Location: Rhode Island, USA
Posts: 516
Doorsdown is just really niceDoorsdown is just really niceDoorsdown is just really niceDoorsdown is just really nice
line buffered input

I am making a parser tool for a project i am doing. I need C/C++ to recieve line buffered input from tcpdump. I can not figure out how to recieve it properly.

Thank you.
__________________
Proud to be have been Fyre, NewDawn, NoS - The Illuminati, [1up]

R3 [Acid] peon
R4 - R7 [Fyre] HC
R7 - R8 [ND] HC
R8 - R13 [NoS] MC
R14 - R16 [1up] MO
R17 Retired
Doorsdown is offline   Reply With Quote
Unread 5 Sep 2006, 08:11   #2
Phil^
Insomniac
 
Phil^'s Avatar
 
Join Date: May 2003
Posts: 3,583
Phil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus would
Re: line buffered input

a quick google reveals http://www.google.co.uk/search?q=lin...-GB:unofficial
from the man pages, http://www.ethereal.com/docs/man-pages/tcpdump.8.html
You can use the -l switch to make stdout line buffered. From there i guess its simply a matter of piping it into your parser tool and working from stdin
__________________
Phil^
Phil^ is offline   Reply With Quote
Unread 5 Sep 2006, 15:24   #3
Doorsdown
Aria's TeddyBear :p
 
Doorsdown's Avatar
 
Join Date: Apr 2002
Location: Rhode Island, USA
Posts: 516
Doorsdown is just really niceDoorsdown is just really niceDoorsdown is just really niceDoorsdown is just really nice
Re: line buffered input

I knew that much, its more of how do i recieve it C?
__________________
Proud to be have been Fyre, NewDawn, NoS - The Illuminati, [1up]

R3 [Acid] peon
R4 - R7 [Fyre] HC
R7 - R8 [ND] HC
R8 - R13 [NoS] MC
R14 - R16 [1up] MO
R17 Retired
Doorsdown is offline   Reply With Quote
Unread 6 Sep 2006, 06:45   #4
Phil^
Insomniac
 
Phil^'s Avatar
 
Join Date: May 2003
Posts: 3,583
Phil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus would
Re: line buffered input

its been a long time since ive done any c++ , but doesnt cin handle input from stdin?
normally this is the keyboard but when data is piped to it, im not sure if stdin changes to this or not.
__________________
Phil^
Phil^ is offline   Reply With Quote
Unread 18 Sep 2006, 15:38   #5
djbass
mmm.. pills
 
djbass's Avatar
 
Join Date: Apr 2000
Location: Australia
Posts: 2,152
djbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond repute
Re: line buffered input

cin does, you can also use the standard file i/o routines to read data by specifying stdin as the file descriptor.

You would likely also need to pipe data from tcpdump to your program.

tcpdump -l | yourprog

Wikipedia entry on piping/redirecting stdio on Unix
__________________
CSS : the result of letting artists design something only an engineer should touch.
djbass is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 16:55.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018