Connect to the internet, then open your application and check for a connection. It will probably say "connected".
Now, without exiting your application, disconnect from the internet and test again for a connection. It will probably still say "connected"??
Jase
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
Originally posted by jase jennings
But there must be a magic method, because every time i fire up internet explorer, it knows instantly if i am online or not, regardless of my connection type.
I'm still searching for the holy grail. If any other contributors would like to step forward and share some ideas, I'd love to hear them
Hi Jase,
I doubt if there is a fool proof or a reliable (in all conditions) way to check if there is a net connection. But if you want the 'magic' that ie uses, its just winsock. To trap all the functions that ie calls, just write a simple LSP and log all the fuctions that passes thru. I did the same, but I don't recall exactly which functions that it called. You can use the same fuction calls.
Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.
Your idea sounds interesting, but I have no idea what you're talking about
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
Your idea sounds interesting, but I have no idea what you're talking about
LSP...Layered Service Provider. It sits between the winsock dll and the base provider such as TCP/IP. All the winsock calls are routed thru the LSP that we hook. Writing the LSP that logs is a simple affair. If you can't get such a code, I can post it after a bit of searching on my system.
Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.
I'd love to see your code Mathew, sounds interesting ...
Thanks
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
Oops...Sorry for the delay. Yesterday we had an unexpected shutdown of the gateway at our office. I'm attaching the file LSP.zip. A readme.txt explains the installation steps. I hope I last left the code at a working condition. If there is anything let me know.
Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.
I think a resonable timeout upper limit is 20 secs. Most of the application, including the connect() api, (although it can be changed) waits for 20 secs. Depending on the application for which we are building, this can be reduced. For a simple normal application I guess some 3-5 secs as time-out would be sufficient.
Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.
but when i did this with CAysncsocket the sequence was different. Now the questoin is to recreate the magical sqquence or use the connect with timeout ...........
Hey Jase,
For me InternetGetConnectedStatus worked ok for dialup and LAn settings.
I tried checking it when.
1] Dial up is installed but no connection. (I got INTERNET_RAS_INSTALLED and false in return)
2] Dial up connected. (I got INTERNET_RAS_INSTALLED & INTERNET_MODEM_CONNECTED& INTERNET_MODEM_CONFIGURED) and TRUE in return.
3] LAN but no Internet
I got (INTRENET_RAS_INSTALLED with FALSE return)
4] LAN and internet connected.
I got INTERNET_RAS_INSTALLED & INTERNET_LAN_CONNECTED with TRUE in return.
I tried several other conditions also and found it works ok. I didnt restarted the application and kept checking the diff. conditions by uninstalling TCP/IP , disabling LAN , disabling dial up default etc.
I tried this code on Win2k , I dont know how it works on 98 , and I guess it will work ok on XP.
What do you guys say , when did it actully failed for you ?
But I believe you that this way isnt reliable, MSDN says same. Thats why i am also interested in finding a perfect way.
I saw that Internet explorer also fools down in concluding the connection some times, like I saw if you disable the LAN and connect using dialup , and disconnect the dialup connection and reenable LAN , IE asks to go ONLINE showing dialup entries to use.
Have u observed it ? I think IE also dont have perfect way.
Originally posted by Krishnaa
I tried several other conditions also and found it works ok. I didnt restarted the application and kept checking the diff. conditions by uninstalling TCP/IP , disabling LAN , disabling dial up default etc.
I tried this code on Win2k , I dont know how it works on 98 , and I guess it will work ok on XP.
What do you guys say , when did it actully failed for you ?
Hi Krishnaa ...
Thanks for your post. I checked your code and it failed immediately
I have an external Motorola DSL modem - connected via standard network cable to a Netgear hardware router. The router has another network cable connecting it to my PC's 10/100 NIC.
Effectively, the router is a hardware firewall which shares the dsl modem among pc's on my network.
I run your program and click on the button - "Connected", it correctly reports.
I then turn off my modem - no internet connection is now possible. I click the button "Connected".
I turn back on the modem and turn off the router - no internet connection is possible. I click the button "Connected".
I unplug my pc from the LAN by pulling the cable out of my NIC. My pc is now totally standalone with no external connections to network , internet or other. I click the button "Connected" it tells me.
Perhaps it works with dialup - but as technology becomes more readily available and cheaper, less and less people will be using 56k modems - moving across to broadband internet instead.
InternetGetConnectedState() simply does not work.
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.