F
Finn Stampe Mikkelsen
Hi
I'm currently working with an app, that needs to be Internet aware and turn
on/off functionallity depending on the availabillity of an internet
connection...
I'm currentliy using this code:
//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int
Description, int ReservedValue );
//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;
}
And it seems to work okay. There is however a considerable delay between
deactivating my network and the app responding to it. I'm using a timer
tick, running ticks at 100ms intervals, but it takes up to 4-5 seconds
before my app responds to the status change.. Sometimes even longer..
Is there a better/faster way to determine internet availabillity than the
above code...??
/Finn
--
Der er 10 slags mennesker - Dem som forstår binær og dem som ikke gør.
There are 10 kinds of people. Those who understand binary and those who
don't.
Es gibt 10 Arten von Menschen. Die, die Binär verstehen, bzw. die, die es
nicht tuhen.
I'm currently working with an app, that needs to be Internet aware and turn
on/off functionallity depending on the availabillity of an internet
connection...
I'm currentliy using this code:
//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int
Description, int ReservedValue );
//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;
}
And it seems to work okay. There is however a considerable delay between
deactivating my network and the app responding to it. I'm using a timer
tick, running ticks at 100ms intervals, but it takes up to 4-5 seconds
before my app responds to the status change.. Sometimes even longer..
Is there a better/faster way to determine internet availabillity than the
above code...??
/Finn
--
Der er 10 slags mennesker - Dem som forstår binær og dem som ikke gør.
There are 10 kinds of people. Those who understand binary and those who
don't.
Es gibt 10 Arten von Menschen. Die, die Binär verstehen, bzw. die, die es
nicht tuhen.