Thread View: borland.public.cppbuilder.internet.web
2 messages
2 total messages
Started by B
Mon, 17 Sep 2007 19:06
Checking If Online
Author: B
Date: Mon, 17 Sep 2007 19:06
Date: Mon, 17 Sep 2007 19:06
6 lines
1065 bytes
1065 bytes
What is the fastest, least resource intensive way to make sure you are online? C++ builder 6 native code sample if possible. Thanks!!
Re: Checking If Online
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads