Internet connection availability notification

  • Thread starter Thread starter yk63fd01
  • Start date Start date
Y

yk63fd01

Hello,


Is there a way to receive a notification when an internet connection
becomes available and when it becomes unavailable?


Thanks.
 
Hi,

No really, there is not such a concept of as connected to the internet,
you can use one of several workaround ( or all of them )

1- Check if the device has at least one IP different that the localhost
2- See if you can connect to some predefined server/address ( this may fail
due to proxies config. )
3- Try to resolve some name to its IP, in general the DNS is always
accesible even if a proxy exist.

Cheers,
 
Hi,

Thanks for the reply. Right now, I have a thread which is attempting
to do ftp transfers, so it does fail in the DNS resolution phase (as
you mentioned above) and sleeps a certain time before trying again.
But, I was hoping to be able to use an interrupt method instead of
polling (as it would be more efficient).

Thanks
 
One other thing. This doesn't have to be done with pure .NET. Isn't
there a way to do this using the Win32 API? I know some things like
receiving notification of a CD inserted can be done with APIs, but I
can't seem to locate anything for network connectivity.
 
Hi,

AFAIK there is nothing like that, as I said before being "connected to the
internet" is relative , maybe there is somethign when a network adapter
change its configuration, don;t know for sure but even so is the same thing,
it may be connected locally and your remote server is not available

pooling is the only solution I see here.

cheers,
 
Back
Top