/* start the capture */ pcap_loop(adhandle, 0, packet_handler, NULL);
The above start capture, but I did not find a way to stop the capture, except for exiting the program ...
Call pcap_breakloop()in your pcap_handler(you named it packet_handlerin your example). Then the call pcap_loop()will return -2.
pcap_breakloop()
pcap_handler
packet_handler
pcap_loop()
-2
Alternatively, repeat the calls pcap_dispatch()until you finish, or specify a non-zero value countto process this number of packets before returning.
pcap_dispatch()
count
Source: https://habr.com/ru/post/1744589/More articles:Написание блока catch с операциями очистки в Java - javais there any way to see what code is executed when the method is called back? - phpHow to install Img-scr from a server that is not live but connected to a Live server - authenticationКак узнать, когда мой контроль изменяет размер? - delphiShould I store #wrapper {width: 100%} in print css? - cssOdd performance when using C # asynchronous server - performanceProper use of Java Weak Reference for nested collections - javacakephp paginate using mysql SQL_CALC_FOUND_ROWS - phpinserting an array into a database table in one query - phpHow do I request an Entity Framework object container for derived class objects? - c #All Articles