Path: news.mathworks.com!not-for-mail
From: "Matthew Simoneau" <matthew@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Check internet connection status using Matlab
Date: Mon, 20 Oct 2008 18:43:02 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 13
Message-ID: <gdijfm$jk9$1@fred.mathworks.com>
References: <cd7fd4a0-a476-4290-a70d-696a8800d7bf@v72g2000hsv.googlegroups.com> <c562fa59-86ba-4fc0-98d3-dad9b19b5051@a70g2000hsh.googlegroups.com> <gdaqd3$lt0$1@fred.mathworks.com> <gdb6kt$3jo$1@fred.mathworks.com>
Reply-To: "Matthew Simoneau" <matthew@mathworks.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1224528182 20105 172.30.248.38 (20 Oct 2008 18:43:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 20 Oct 2008 18:43:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 25640
Xref: news.mathworks.com comp.soft-sys.matlab:496336


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);