- while(1) {
- if((select(pcap_fd+1,&pcap_fd_set,NULL,NULL,&fd_set_tv)) && (FD_ISSET(pcap_fd,&pcap_fd_set))) pcap_loop(pcap_handle,-1,pcap_process,(u_char *)&my_info_struct);
- else if((hop_channel(&my_info_struct,pcap_fd))==-1) {
+ while (1) {
+
+ /* set pcap_fd */
+ FD_ZERO(&pcap_fd_set);
+ FD_SET(pcap_fd,&pcap_fd_set);
+ fd_set_tv.tv_sec=0;
+ fd_set_tv.tv_usec=500000;
+
+ if((select(pcap_fd+1,&pcap_fd_set,NULL,NULL,&fd_set_tv)) && (FD_ISSET(pcap_fd,&pcap_fd_set))) pcap_dispatch(pcap_handle,-1,pcap_process,(u_char *)&my_info_struct);
+ else if((hop_channel(&my_info_struct,foo_fd))==-1) {