Libpcap programming is a strange problem-Linux general technology-Linux programming and kernel information. The following is a detailed description. Supplement: sometimes it can be executed, but the probability is low.
Online and so on. I posted it in the technical exchange edition. Nobody knows me. resend the post once. If you want to delete the post, delete it. this problem cannot be solved. it is the client of Digital China verification. if you are interested, you can communicate with each other.
In ubuntu7.10, I want to use libpcap to send/receive packets...
I wrote it in Xp. The program is okay.
Check the following code. // sorry, the program is in ubuntu and the dual system cannot access the Internet.
CODE: # include... // the header file is okay.
Int main ()
{
... // Initialization
While (1)
{
....
Printf ("send pkt... \ n"); // OK
Pcap_sendpacket (open_dev, pkt, sizeof (pkt);/OK
Prinf ("over"); // problem: Sometimes the program stops printing this sentence.
Break;
}
Printf ("waiting response ..... \ n "); // problem: Sometimes it stops here.
While (1)
{
// The following is the response packet
Pcap_next_ex (open_dev, hdr, recpkt );
....
}
} |