Re: [tcpdump-workers] Compatibility Libpcap/Winpcap and timout of

2009-01-28 Thread Guy Harris
On Jan 28, 2009, at 1:48 AM, Benoit wrote: Okay so I should use something like this: int ret=0; Assigning 0 to ret isn't necessary, as you're setting it to the return value of pcap_select_ms() immediately after assigning 0 to it. if((ret =pcap_select_ms(ifhard->adhandle,ifhard->timeout)

Re: [tcpdump-workers] Compatibility Libpcap/Winpcap and timout of

2009-01-28 Thread Benoit
Okay so I should use something like this: int ret=0; if((ret =pcap_select_ms(ifhard->adhandle,ifhard->timeout)<=0)) { if((ret=pcap_next_ex(ifhard->adhandle, &(ifhard->header), (const u_char**)(&p_pkt))> 0) { ... } } return ret; This let me be sure that if no packet are received the pcap_selec

Re: [tcpdump-workers] Compatibility Libpcap/Winpcap and timout of

2009-01-27 Thread Guy Harris
On Jan 27, 2009, at 5:14 PM, Aaron Turner wrote: What is the solution on *BSD/OS X where you want a timeout If you want a timeout, in the sense of something that means that you'll *never* block forever waiting for packets to arrive, then: if you *only* care about platforms where the time

Re: [tcpdump-workers] Compatibility Libpcap/Winpcap and timout of

2009-01-27 Thread Aaron Turner
On Tue, Jan 27, 2009 at 4:26 PM, Guy Harris wrote: > If you want a timeout, so you don't wait forever for a packet to arrived, > I'd suggest using select() or poll() on UN*X systems (other than *BSD and > Mac OS X, where select() and poll() might not work correctly on BPF devices > - and, in the

Re: [tcpdump-workers] Compatibility Libpcap/Winpcap and timout of

2009-01-27 Thread Guy Harris
On Jan 27, 2009, at 4:43 PM, Matthew Luckie wrote: I think the problems with select on BPF devices on FreeBSD have been solved for a long time. Certainly on all currently supported versions of FreeBSD. I think it's fixed on sufficiently recent versions of all of the *BSDs, but 1) som

Re: [tcpdump-workers] Compatibility Libpcap/Winpcap and timout of

2009-01-27 Thread Matthew Luckie
If you want a timeout, so you don't wait forever for a packet to arrived, I'd suggest using select() or poll() on UN*X systems (other than *BSD and Mac OS X, where select() and poll() might not work correctly on BPF devices - and, in the case of Mac OS X, where poll() doesn't work *at all* on "

Re: [tcpdump-workers] Compatibility Libpcap/Winpcap and timout of pcap_next_ex().

2009-01-27 Thread Guy Harris
On Jan 27, 2009, at 9:17 AM, Benoit wrote: I've start a simple protocol to communicate with FPGA using only MAC layer. This software should run under linux and windows, however i've a problem with the timeout of pcap_next_ex() function under linux. There is no guarantee that, with a timeo

[tcpdump-workers] Compatibility Libpcap/Winpcap and timout of pcap_next_ex().

2009-01-27 Thread Benoit
Hello, I've start a simple protocol to communicate with FPGA using only MAC layer. This software should run under linux and windows, however i've a problem with the timeout of pcap_next_ex() function under linux. With winpcap when a packet is not coming the pcap_next_ex() return 0 but in linux th