[Winpcap-users] select()
Jonathan Hunt
jgwehunt at gmail.com
Fri Feb 16 16:48:37 GMT 2007
Hi again. I've been trying to get pcap_getevent() to work with
WaitForSingleObject(), but without success. Here's a code fragment which
will hopefully illustrate my problem:
while(TRUE) {
while(clientstate < STREAMING) {
if(WaitForSingleObject(pcap_getevent(skinny),0)==WAIT_OBJECT_0)
{
if(skinny_received = pcap_next_ex(skinny, &skinny_header,
&skinny_data) > 0) {
(pcap_t *skinny has been initialised with pcap_open() and then had a filter
applied to it...the code worked before I added the above pcap_getevent()
section.)
For some reason WaitForSingleObject never returns WAIT_OBJECT_0 (it always
returns 0x102). I'm developing with Winpcap4.0 and XP Pro SP2, Visual Studio
2005 SP1...the compiler's set to compile it as C code, not C++.
Any advice would be much appreciated - hopefully it's just a stupid
oversight on my part.
Thanks
Jonathan
On 07/02/07, Gianluca Varenni <gianluca.varenni at cacetech.com> wrote:
>
> Jonathan,
>
> you need to call pcap_getevent() and obtain a HANDLE you can wait on with
> WaitForSingleObject or WaitForMultipleObjects().
>
> You cannot obtain a file descriptor and use a select() on windows.
>
> Have a nice day
> GV
>
> ----- Original Message -----
> From: "Jonathan Hunt" <jgwehunt at gmail.com>
> To: <winpcap-users at winpcap.org>
> Sent: Wednesday, February 07, 2007 3:19 PM
> Subject: [Winpcap-users] select()
>
>
> > Here's a quick question:
> >
> > Using WinPcap 4, is it possible to call select() or poll() or something
> > to that effect to tell me when there is data to be read on a pcap
> > "socket"?
> >
> > Many thanks
> >
> > Jonathan
> > _______________________________________________
> > Winpcap-users mailing list
> > Winpcap-users at winpcap.org
> > https://www.winpcap.org/mailman/listinfo/winpcap-users
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20070216/47df4018/attachment.htm
More information about the Winpcap-users
mailing list