<div dir="ltr">Thank you very much for your time Guy, you are always ready to answer this kind of questions.</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/27 Guy Harris <span dir="ltr"><<a href="mailto:guy@alum.mit.edu" target="_blank">guy@alum.mit.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On May 27, 2013, at 7:26 AM, Asier Martínez <<a href="mailto:axierr@gmail.com">axierr@gmail.com</a>> wrote:<br>
<br>
> I'm trying to achieve a portable way of reading from multiple pcap devices in non blocking.<br>
> As far as I know, on Windows select() function it's nos usable with Winpcap because there is no file descriptor for that purposes available into the library, and this functionality must be implemented obtain a win32 HANDLE with pcap_getevent() and wait on it with WaitForSingleObject/MultipleObjects(Ex).<br>

<br>
</div>That's the correct way to do that on Windows.<br>
<div class="im"><br>
> On the other hand, I read on release changelog on Winpcap.org:<br>
><br>
> Version 3.01 alpha<br>
>       • pcap_fileno returns a valid description also in case of a remote capture, so that the'select()' function can be used to check if packets are waiting to be read<br>
<br>
</div>WinPcap is a port of libpcap to Windows, and shares a lot of code with libpcap; the remote capture code can work on UN*X as well as on Windows.<br>
<br>
That particular changelog item probably refers to the remote capture code on UN*X.<br>
<div class="im"><br>
> ¿What is the most portable ( and correct ) approach to read from multiple interfaces with winpcap ?<br>
<br>
</div>There isn't one.  There's one that works on UN*X (except when it doesn't, e.g. BPF only works with select() with newer versions of the various *BSDs and OS X, and in some OS versions, the workaround for that doesn't work), namely using select(), and and there's one that works on Windows, namely WaitFor....<br>

<div class="im"><br>
> pcap_fileno returns a valid descriptor or not?<br>
<br>
</div>On Windows, it happens to return a HANDLE (assuming a HANDLE fits in an int), but it's not necessarily the HANDLE for something on which you can do a WaitFor....<br>
_______________________________________________<br>
Winpcap-users mailing list<br>
<a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
<a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
</blockquote></div><br></div>