Article View: borland.public.cppbuilder.internet.web
Article #174Re: Checking If Online
From: Mark Jacobs
Date: Wed, 26 Sep 2007 19:13
Date: Wed, 26 Sep 2007 19:13
25 lines
1542 bytes
1542 bytes
"B" <traderr@gmail.com> wrote in message
news:46eed047@newsgroups.borland.com...
> What is the fastest, least resource intensive way to make sure you are
> online?
>
> C++ builder 6 native code sample if possible.
AnsiString checkitout()
{
WSADATA wsa={0};
int ret=WSAStartup(MAKEWORD(1,0),&wsa);
if (ret!=0) return "!! WSA Startup Error "+AnsiString(ret);
struct hostent *mhstj;
mhstj=gethostbyname("www.microsoft.com");
WSACleanup();
if (!mhstj) return "!! Error "+AnsiString(WSAGetLastError());
return "No Problem";
}
Returns something beginning with "!!" if there is a problem, otherwise it
returns "No Problem". HTH,
--
Mark Jacobs
www.jacobsm.com
Technical Details
Message-ID:
<46faaf53@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<46eed047@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,a1a33c7a62b5fb62 X-Google-Attributes: gidfeeec,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Mark Jacobs" <mark@jacobsm.com> Newsgroups: borland.public.cppbuilder.internet.web References: <46eed047@newsgroups.borland.com> Subject: Re: Checking If Online Date: Wed, 26 Sep 2007 20:13:17 +0100 Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 195.137.123.182 Message-ID: <46faaf53@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1190834003 195.137.123.182 (26 Sep 2007 12:13:23 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail