LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 02-16-2003, 12:25 PM   #1
Penguinizer
LQ Newbie
 
Registered: Dec 2002
Location: Egypt
Distribution: Mandrake
Posts: 28

Rep: Reputation: 15
Read() function In "socket.h" RAW_STREAM


I'm trying to write a simple packet sniffer and I'm using the function provided by C++ , I have 3 questions .

1. when I define socket (..... , ......... , IPPROTO_RAW) to work on raw protocol it doesn't work ? But works fine on TCP (IPPROTO_TCP) and everything else ???????????

2. when calling this function my program freezes until any packet arrives how can I avoid that ??

3. I'm writing all this to sniff modem packets can I use anything else ??

Thank You

PS. is there any related code to download ?
 
Old 02-21-2003, 04:50 PM   #2
allegro
LQ Newbie
 
Registered: Feb 2003
Location: New Zealand
Distribution: Slackware 8.1
Posts: 5

Rep: Reputation: 0
iptables

man iptables
 
Old 02-21-2003, 04:56 PM   #3
iceman47
Senior Member
 
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123

Rep: Reputation: 47
Re: iptables

Quote:
Originally posted by allegro
man iptables
That's like the most stupid oneliner I've ever seen.
iptables is a firewall, not a packet sniffer.
As for your questions: I don't know anything about raw sockets, but if you want to sniff packets, snort is a good choise imho
edit: you might want to check this out if you want to code it yourself: http://www.ecst.csuchico.edu/~beej/guide/net/

Last edited by iceman47; 02-21-2003 at 04:57 PM.
 
Old 02-22-2003, 01:14 AM   #4
cybercop12us
Member
 
Registered: Aug 2001
Posts: 60

Rep: Reputation: 15
i think you can use libpcap api for capturing and sniffing packets..
most of the packet sniffers are made up of this library i believe..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Getting "Short read in buffer_copy" error with "dpkg" stalefries Linux - Software 6 03-24-2010 03:19 PM
Replacing "function(x)" with "x" using sed/awk/smth Griffon26 Linux - General 3 11-22-2006 10:47 AM
When "function pointer" meets "template"... I can't get rid of this compiling er cyu021 Linux - Software 3 12-17-2004 07:52 PM
"Function not implemented" error in call to "sem_open()" Krishnendu8 Linux - Newbie 1 06-07-2003 02:52 AM
"Function not imlemented" error in call to "sem_open()" Krishnendu8 Linux - Networking 0 06-07-2003 02:19 AM


All times are GMT -5. The time now is 11:56 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration