From: Jason on
"Scott Burnside" <no(a)spam.com> wrote in message <gdiupj$l2q$1(a)fred.mathworks.com>...
> "Matthew Simoneau" <matthew(a)mathworks.com> wrote in message <gdijfm$jk9$1(a)fred.mathworks.com>...
> > Scott, I think we can simplify your code by using URLREAD:
> >
> >
> > function flag = isnet()
> > % This function returns a 1 if basic internet connectivity
> > % is present and returns a zero if no internet connectivity
> > % is detected.
> >
> > % define the URL for US Naval Observatory Time page
> > url = 'http://tycho.usno.navy.mil/cgi-bin/timer.pl';
> >
> > % Try to connect to it.
> > [unused,flag] = urlread(url);
>
> Nice. Man that is compact.
>
> Scott


similar response:

urlread('http://www.google.com')
??? Error using ==> urlread at 108
Error downloading URL.

if you use urlread and do a try catch type command you will get your function.

this returns html if it gets the site. the above error is if i turn my wireless connection off.