[Winpcap-users] Re: breaking out of a pcap_next_ex() loop
Gianluca Varenni
gianluca.varenni at cacetech.com
Mon May 15 16:22:04 GMT 2006
----- Original Message -----
From: "Gubrush ." <vga_planets at hotmail.com>
To: <winpcap-users at winpcap.org>
Sent: Monday, May 15, 2006 2:02 AM
Subject: Re: [Winpcap-users] Re: breaking out of a pcap_next_ex() loop
> Hi
>
> It was a little late on friday for me as well. Didnt realize what he did.
> Except pcap_breakloop is working as intended for my use.
>
> I didn't know pcap_breakloop was bad, if it is, then why is it there? :)
I didn't say "it's bad". I just said that I personally don't like too much,
and it can have side effects that can create problems.
The most important problem is that it doesn't actually stop the capture
immediately: if simply exits the capture loop *when* the read timeout occurs
or at the first reception of a packet (whatever comes first). If you put a
long timeout (say 10 seconds) and you don't receive packets,
pcap_next_ex/pcap_loop/pcap_dispatch will return after up to 10 seconds.
Have a nice day
GV
>
> It solves my problems of stopping captures when I want them to stop.
>
>
>>From: "Gianluca Varenni" <gianluca.varenni at cacetech.com>
>>Reply-To: winpcap-users at winpcap.org
>>To: <winpcap-users at winpcap.org>
>>Subject: Re: [Winpcap-users] Re: breaking out of a pcap_next_ex() loop
>>Date: Fri, 12 May 2006 08:55:08 -0700
>>
>>Well, pcap_breakloop would work but, as I wrote in the other mail, the UI
>>is not responsive since it's stuck receiving packets in the
>>"onButtonCapture" handler...
>>
>>In any case, I usually prefer not to use "pcap_breakloop". This API is
>>there mainly to interrupt a pcap_loop or pcap_dispatch call, if you use
>>pcap_next_ex you don't have the problem of breaking the internal loop of
>>"pcap_loop" or "pcap_dispatch", because you explicitely create the loop
>>surrounding pcap_next_ex.
>>
>>Have a nice day
>>GV
>>
>>
>>
>>
>>----- Original Message ----- From: "Gubrush ." <vga_planets at hotmail.com>
>>To: <winpcap-users at winpcap.org>
>>Sent: Friday, May 12, 2006 7:53 AM
>>Subject: RE: [Winpcap-users] Re: breaking out of a pcap_next_ex() loop
>>
>>
>>>Hi
>>>
>>>How about pcap_breakloop( pointer_to_handle );
>>>
>>>http://www.winpcap.org/docs/docs31/html/group__wpcapfunc.html#ga15
>>>
>>>
>>>
>>>>From: joe kibz <chikabanga2005 at yahoo.com>
>>>>Reply-To: winpcap-users at winpcap.org
>>>>To: winpcap-users at winpcap.org
>>>>Subject: [Winpcap-users] Re: breaking out of a pcap_next_ex() loop
>>>>Date: Fri, 12 May 2006 05:53:59 -0700 (PDT)
>>>>
>>>>problem:
>>>>
>>>> here's my code in brief:
>>>>
>>>> void CButton::onButtonCapture(){
>>>>
>>>> open a device handle;
>>>>
>>>> while(pcap_next_ex())//capture packets;
>>>>
>>>> }
>>>>
>>>> ?How do i break out or stop a pcap_next_ex() loop whenever i want ?
>>>> ?How does the timeout value in pcap_next_ex() parameters work ?
>>>>
>>>>
>>>> joe
>>>>
>>>>
>>>>---------------------------------
>>>>Yahoo! Mail goes everywhere you do. Get it on your phone.
>>>
>>>
>>>>_______________________________________________
>>>>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
>>
>>_______________________________________________
>>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
More information about the Winpcap-users
mailing list