Application Fails

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I think I have it figured out. My custom shell waits about 30 seconds
before it fires up my main application. I do this to avoid the application
from starting while XPe is not ready. The 30 second delay fixed the problem
for the most part, but every once in awhile, it still happens.

I narrowed it down to a screwy router. Sometimes it locks up and hangs on
issuing IP Addresses. So, XPe hangs around forever until it times out,
before it continues to start all the other services. In order to safe gaurd
against that, I have to enter a huge delay, like 1 minute but that sure
doesn't seem right.

If the cable is unplugged, then things happen quick.
If the cable is plugged in, there is a small delay (15 seconds or so) "If"
everything is right.
But then, if it's not right, Error City here we come!

1) Is there a way to set the max timeout for DHCP to obtain an address?
2) How is the best way for me to detect this with my shell program, so I
don't need to wait unless I have to.

Will the below method solve that, for sure?

Snip from Slobodan's suggestion:

Use following in loop for 50-100 times
{
CMP_WaitNoPendingInstallEvents(INFINITE);
Sleep(10);
}

Thanks,
Richard
 
Hi Richard,

You can write simple application that will detect if DHCP is present, or even renew lease: Start from this sample and read
surrounding topics:
http://msdn.microsoft.com/library/d.../en-us/dhcp/dhcp/dhcp_client_api_examples.asp

And of course check category of "IP Helper" functions.

I don't know if WaitNoPentindInstallEvent will help in your case (it might) but if having network working is imperative then you
should try to first determine current DHCP lease parameters and network state and then for safety only use loop I suggested.

BTW:
Idea with the loop is crude but it is better then 15-30 seconds wait. General idea was that Wait will pass immediately if there is
no PnP work done in background so full loop would last 1 second. For every additional work detected Wait will block loop execution
until all detection operation in this enumeration are done.
Sleep is necessary since there are small gaps in PnP detection and Wait alone is not enough.

Best regards,
Slobodan
 
Richard,

You even can start the image with dhcp disabled. Enable it after your shell
is up and running (using DHCP Client API or just start the service).
At least it won't hang your image and user may still be able to use GUI.

Btw, I am not sure how PnP wait loop can help with DHCP problem?

KM
Hi Richard,

You can write simple application that will detect if DHCP is present, or
even renew lease: Start from this sample and read
surrounding topics:
http://msdn.microsoft.com/library/d.../en-us/dhcp/dhcp/dhcp_client_api_examples.asp

And of course check category of "IP Helper" functions.

I don't know if WaitNoPentindInstallEvent will help in your case (it
might) but if having network working is imperative then you
should try to first determine current DHCP lease parameters and network
state and then for safety only use loop I suggested.
BTW:
Idea with the loop is crude but it is better then 15-30 seconds wait.
General idea was that Wait will pass immediately if there is
no PnP work done in background so full loop would last 1 second. For every
additional work detected Wait will block loop execution
 
Hey, that works pretty good ! Glad I finally tried it !
Snip from Slobodan's suggestion:


Now I will look into the below as well.




Slobodan Brcin (eMVP) said:
Hi Richard,

You can write simple application that will detect if DHCP is present, or
even renew lease: Start from this sample and read
 
Konstantin,
Btw, I am not sure how PnP wait loop can help with DHCP problem?
Like I said I'm not sure either, but I said that he should wait first for IP lease and then do the Wait... as safety measure only.
Although Wait... implementation could include DHCP wait as well since as you know if there is no DHCP server we have extremely long
boot time (hourglass, or irresponsive commands) so this indicates that something is done by some service that could be seen by
Wait.. command as well.

Best regards,
Slobodan
 
KM, SB,
The Wait seems to work as I see the time delays by either plugging in the
Network Cable, removing the cable, or unplug the router during boot. So
Evidently, it see's it somewhere.

I'm going to do more testing....

Thanks for all the help...
Richard
 
Well.. You may be right here.
I thought a little bit more about that and came to conclusion that there might be some influence.
Anyway.. the Richard's testing proved the point.
 
Back
Top