|
-
February 5th, 2003, 01:47 PM
#1
Check the internet connection state
Hello,
I would like to be able to detect if the computer is connected to Internet. I've tried InternetGetConnectedState() from wininet, but I always get TRUE, nethertheless I'm connected or not.
I would like my application to check pop3 accounts, but if the computer is not connected, there is a hang (big timeout when trying to connect).
Thanks.
-
February 6th, 2003, 06:30 PM
#2
check this source:
http://spiff.tripnet.se/~iczelion/files/Welcome2Net.zip
its i Win32Asm, but there isn't much diff, actually they are the same, just diff syntax!
have fun translating
Bengi
-
February 7th, 2003, 12:55 AM
#3
Thanks, dont worry I've got no pb with asm and it's the same API.
-
February 7th, 2003, 01:27 AM
#4
to translate......(even though i'm sure you can do it)
WSADATA wsadata;
WSAStartup(0x101, &wsadata);
if(gethostbyname("www.microsoft.com") != NULL)
We_are_online();
else
Offline();
WSACleanup();
this is one method but also you might want to try using
gethostname();
and then gethostbyname(); with information returned from the first one. then you can enumerate the IP list returned and check against common local ips *127.0.0.1 or home network ones*
-
February 9th, 2003, 02:31 AM
#5
BOOL InetIsOffline(
DWORD dwFlags,
);
or
DWORD RasEnumConnections(
LPRASCONN lprasconn, // buffer to receive connections data
LPDWORD lpcb, // size in bytes of buffer
LPDWORD lpcConnections // number of connections written to buffer
);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|