"Didn't grab packet" Problem
Hi,
I download a simple program call testpcap1.c and successfully compile on Ubuntu. But when running, it outputs this: DEV: eth0 Didn't grab packet Please help. > uname -a Linux 2.6.28-18-generic #60-Ubuntu SMP Fri Mar 12 04:40:52 UTC 2010 i686 GNU/Linux > ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:bb:38:05:c2:a1 inet addr:10.0.0.57 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::21b:38ff:fe05:a0c4/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:12925 errors:0 dropped:0 overruns:0 frame:0 TX packets:14219 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:10854790 (10.8 MB) TX bytes:2547313 (2.5 MB) Interrupt:19 --------------------------- The program content is: Code:
/*************************************************** |
I am guessing this is not the output you were looking for?
What did you expect to see? Do you understand how the code works? A quick glance at the code says this is the offending section: Quote:
|
You probably need to run your program with root privileges.
--- rod. |
Did you find the answer ? if yes, can you share with us pliz ?
|
I got the answer after these days studying sniffering...and libpcap. In fact there is no wrong at all, i guess, just because pcap_next() run too fast after the "descr" take control of the adpter. Before "descr" gets its first sweet packet, pcap_next() has already run over...---a hardware mater, i thought...
So just place a "sleep" before pcap_next() would make it OK. like this: Quote:
|
still not working with the sleep()////
any other method ?? |
sleep() works
sleep() works. Thank you. :) Maybe we should mention it to the lpcap people, since it is potential issue..
|
testpcap1.c
SLEEP is working fine...
This program is used for capturing one packet... How to modify the program for capturing n number of packets |
Quote:
|
Hello,
Any updates on this issue? sleep is not working for me. i am getting below error "Didn't grab packet". Please help me. Thanks in advance |
Please raise your own ticket and reference this one if relevant. A 4 year old ticket should not be resurrected.
|
I think he did a good job keeping the question in the right thread. It's on topic and 100% related. If someone answers him here, and later someone searches for it, they will be able to find the answer -- all in one convenient spot.
The only "Rule" about posting in a thread is this: Quote:
|
Quote:
Not the best solution, but an actual solution: Code:
while(1) |
All times are GMT -5. The time now is 10:59 PM. |