[Winpcap-users] pcap_findalldevs Hangs when called in Windowsservice

Thomas O'Hare Tom at RedTile.Com
Sat Aug 12 12:53:18 GMT 2006


As a follow up to my last message, I will add one feature of FireDaemon
that may be beneficial after re-reading the messages.

FD allows you to set a "delay" as to when your service will start.  IOW,
a "normal" Win Service usually starts at boot when a lot of other stuff
is going on.  Collisions or timing errors?

I have some network software "servers" I wrote and use them as services.
 But I set the delay to 10 & 15 seconds respectively on the server to
even allow each instance of y server time to load to cut down on CPU.
This will (hopefully) allow the OS to get settled in before my services
are launched.  This will also allow or give time for critical OS stuff
to load w/o the extra overhead of my software competing for CPU time
along with many other services.

There are many other options such as crash stuff, interact with desktop
& much more.

BTW, I am not affiliated with FD in any way except as a licensed user.

FD, was for me, just a cleaner way to safely get my network software
servers loaded an working in a way that allowed them to load and work
gracefully.

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/


Richard Bellengere wrote:
> 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
> 
> 
> 
> 
> _______________________________________________
> 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