[Winpcap-users] pcap_findalldevs Hangs when called in Windowsservice

Richard Bellengere RichardB at thoroughtec.com
Fri Aug 11 15:40:59 GMT 2006


Hi Thomas

Thanks for your response.

My problem comes in that the program is being run as a Win32 Service.
The OS loads the services into threads that are created and controlled
by the Service Manager. The main work of my app is run within one of
those threads.

When I run my app standalone I have exactly what you say - findalldevs
is run in the main thread. But when run as a service my program's main
thread is actually a subthread of the service manager and findalldevs
fails.

The apps is required to autodetect the first network card and start
listening on it. Perhaps I can pre-configure its name into a registry
key or something and bypass findalldevs.  Will try that next week.

Regards
RichardB

-----Original Message-----
From: winpcap-users-bounces at winpcap.org
[mailto:winpcap-users-bounces at winpcap.org] On Behalf Of Thomas O'Hare
Sent: 11 August 2006 16:16
To: winpcap-users at winpcap.org
Subject: Re: [Winpcap-users] pcap_findalldevs Hangs when called in
Windowsservice

Richard

OK, excuse the blatant ignorance of my question, but I am just curious.

Since pcap_findalldevs_ex(), IMO, is very seldom called, why are you
using sub-threads?

IOW, one call and you have your list and then can use that list for a
determinant period of time.  If changes occur you can just call the
function again manually.

If you can enlighten me I would appreciate it.

Thanks,
~ Thomas O'Hare ~
President, RedTile, Inc. - DBA: RedTile Software Web, Wireless, Network,
Database & Systems Software
+1.407.295.9148 ; +49.8651.717950 ; http://www.RedTile.Com/
Operations Manager; Virtual FoxPro User Group Tom at VFUG.Org ;
http://www.VFUG.Org/


Steighton_Haley at mcafee.com wrote:
> Yes, confirmed, I have seen the same bug in my application as well.
>  
> And as you note, it always happens when pcap_findalldevs_ex is called 
> from a sub-thread, rather than the main thread of my application.
> 
> 
> ________________________________
> 
> 	From: winpcap-users-bounces at winpcap.org 
> [mailto:winpcap-users-bounces at winpcap.org] On Behalf Of Richard 
> Bellengere
> 	Sent: Tuesday, August 08, 2006 5:44 AM
> 	To: winpcap-users at winpcap.org
> 	Subject: [Winpcap-users] pcap_findalldevs Hangs when called in 
> Windows service
> 	
> 	
> 	Hi.
> 	 
> 	I'm getting exactly the same thing.  Did you ever get a solution
to 
> this problem?
> 	 
> 	It seems to have something to do with findalldevs being called
from a 
> new thread and not the process's main thread.
> 	 
> 	Thanks
> 	RichardB
> 
> 
> 
> 
> ----------------------------------------------------------------------
> --
> 
> _______________________________________________
> 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