Originally posted by anima_sg
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 ...........
You have to use winsock APIs rather than CSockets. For such situations you need to have more control over what is happening...so APIs are the best.
Originally posted by jase jennings
Thanks for your post. I checked your code and it failed immediately
I think what Jase should do is to choose one of the method that suits the situation. The user should have the responsibility to fix the problem. Well, to know if there is net connection we all use IE to check. So I think we should follow the approach that IE uses. Searching for the 'fool proof' solution if one doesn't exist is just a waste of time. In the course of time, if someone gets such a solution, please participate us with it.
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.
The IE way isn't foolproof either. I'm running my internet off a DSL/LAN.
When I installed WinXP, and started IE, it always popped up a dial-up networking (DUN) connection dialog, which I don't need for internet, but need for connection to client VPN's. Clearly this DUN wasn't needed, since internet is always up (except when I turn the modem off).
It took me some time to figure out how to make IE no longer popup the DUN, but still make DUN work for the VPN's.
I'm not the expert on internet related stuff, but I think it's a bit of a catch 22.
The only way to detect if you REALLY have internet, is to actually open the connection you need to the remote server. Without that, whatever method you try for attempting the connection may get blocked by HTTP proxy or router. (note that ICMP packets are more and more getting blocked).
And actually opening a connection to a remote server may popup the DUN, you may be able to get around the standard Windows DUN, but not everyone uses that (like me). There are several other connection software packages.
"temporarily" disabling the DUN by changing the registry as someone suggested won't work for anything but MS' default DUN (and it's a bad idea messing with such registry settings from your code anyway).
the IE way may be more or less the safest way, but you should provide a way in your code to override the code (providing a 'detect', 'assume never online' & 'assume always online' kind of approach). I know at least 3 programs I can't use at home because they INSIST on starting DUN, and won't run until DUN made a connection to the internet (which it never does, since internet doesn't go over DUN in my case). Tech support of those programs told me to 'deinstall DUN if you have internet over LAN', but that isn't an option because I need DUN. It's very annoying to have software that's this inflexible. (and tech support which is even more rigid)
Tells me i am not connected, although i have a connection via dsl modem. I couyldn't find a way to get this to report "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....
hey even i have a dsl modem and it is working fine ..............i''ll send the debug version which will report the error so we know why is it happening can u pls test it
Originally posted by anima_sg
here is the debug version
it returns "error not defined" - "not connected".
I'm on windows XP.
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
You need to add wininet.lib to the link section of the project properties
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
I think as perfect an answer as you're gonna get lies in the answers above
I haven't gotten around to coding it yet due to time demands on another project. When I do, I'll post it. If someone else does it first, I'd really appreciate them sharing it here.
Thanks guys
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.