Posted by
Udo Schneider on
Feb 22, 2005; 9:57pm
URL: https://forum.world.st/Detecting-internet-connection-and-it-s-kind-tp3373235p3373236.html
Sebastián,
AFAIK this is the only built-in method of testing connectivity. If this
is successfull you'll know that the following works:
* Ethernet(ARP)/Modem
* Routing (if the url is hosted outside of your network)
* DNS (if you use hostnames in your URL)
* There is no device blocking http
The problem might be to dertermine what exactly you'll need. Depending
on this deccision you might want to do your own checks. Some of these
checks might require some M$ Network APIs. I think the IP Helper APIs
(
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/ip_helper_start_page.asp)
should do most of the job.
1) Check if local connectivity is available: For Ethernet this means to
check whether the NIC has a link.
2) If a default GW is set, ping it (I can send you my ICMP code if you
want). If this fails ICMP might be blocked by a FW. Check whether the IP
address resolved to an ARP entry. This tells you at least that you can
reach the default GW.
3) Check DNS: The class InternetAddress might help you here. If the DNS
Servers are in a different subnet you know that DNS and routing works
4) Try to access a resource (e.g. httpd) on a non local subnet host. If
this works you're done.
Hope this helps.
CU,
Udo
Sebastián Sastre wrote:
> Hi all,
>
> beside #ping: anURL, I can't find a way to detect if the host running
> the application is connected to the internet. Anybody does?
>
> I can't remember now, but I'm pretty sure I was playing arroung, about a
> year ago, with some method like #hasInternetConnection or #isModemConnection
> or #isLANConnection
>
> Anybody knows it? perhaps some goodie?
>
> thanks,
>