Been there, done that Doesn't work as described...
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
Been a long time. I have been looking for a solution to the problem this 90+ response thread has generated. I HAVE NEVER FOUND A RESONABLE SOLUTION EITHER. It is extremely frustrating! There is no reasonable way to actually check for connectivity. Don't give up, someday there will be an answer. I hope....
There IS an answer already. Just open up Internet Explorer - it knows exactly when you are connected and when you are not.
But we don't know it ... or at least not the complete solution anyway.
I keep responding to this post in the hope that somebody will deliver us an API function which we are all missing
Here's hoping anyway...
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
this is a simple winsock based function
that checks for connectivity based on the validation of the IP address, i.e. if the ip returns x7.0.0.1, you are not connected, very simple, and i have had no troubles with it.
i've also include a simple app based on this routine.
the app includes borrowed code, namely the CLed class for exhibiting transparent Leds and also a vector template from localipquery or something like that.
in the app, the use of a timer allows for realtime updating of the connectivity status, the hostname, and the IP.
Last edited by jtevermore; January 23rd, 2004 at 11:38 PM.
Assuming you've figured out how to detect an Internet connection, THEN WHAT?
I really like the way Microsoft and others provide a menu item, Check for Updates. Often, these connections link to some server that has the capability of investigating your current software capabilities and suggesting updates or not if they are indicated.
Does anyone have a clue as to how this is done? I presume that your resident software sends some version information to the server. The server must then interpret the info sent and respond appropriately, either by:
1 - Do you wish to download and install the updates now?
2 - No updates are required.
3 - No updates are available.
I have a server available to do this sort of thing, but havnt a clue as to how to proceed.
The server may only provide actual version information. The client receives this information, checks whether an update is possible / recommended and queries the server for the respective updated files. Ater receiving the files, the client process starts the downloaded update or installs the downloaded files.
Hi Jase
As I read in this post, you did various checks with the IE. I'm connected via peer to peer (over a switch) LAN with a gateway computer that provides DSL. Played a little with the IE (v5.00.2614.3500, Win98se) and found the following:
Disconnected the internet at the gateway computer and started IE. Tried to navigate to www.microsoft.com. IE tried some urls (according to the status bar of IE, appended .com/.org etc.) about 20 seconds each. Tried another page and IE tried to connect about 40 seconds, then tried variations.
So I do not understand what exactly IE does that is better than a simple "OpenURL" or "Connect" (except IE obviously do it asynchronous).
BTW, if IE do a better job than we can right now, can't we just use IE (via COM interface) to do our task? Ok, our customers would need a specific minimal version of IE. Just an idea.
Originally posted by Mike Pliam
Does anyone have a clue as to how this is done? I presume that your resident software sends some version information to the server...
Mike
Hello Mike
The way SlideShow Desktop does this, is really very simple.
I hold a text file on my website, my application can retrieve it using standard microsoft internet api calls,
( I forget which ones ). With this small text file held in memory, I parse the information and react appropriately.
The text file contains the version number of the latest release, the url for the release, and descriptive text regarding the release.
I also place in here the url of the most recent text file containing the update information.
When installing the application, a registry key is created containing the url of the update file.
So when you choose to check for update, it fetches the url held in the registry.
If the url contained in the file is different to the one you have just fetched, it writes the new value to the registry,
and then goes through the process again - allowing it to pick up the new file in the event you
have decided to change its name or location.
The version number in the text file is compared with the version held internally by the app.
If the text file contains a later release, you popup your dialog asking "do you want to update".
If yes, you use the same standard api calls again to download the update (typically, it's an installshield installation set).
When it's downloaded, you can then ask the user if they wish to update.
If they do, you run the installer using ShellExecute, then exit your app.
The implementation is entirely up to you. The point being, all you have to do is retrieve a text file from your website, and you have the basis of your update procedure.
Hope this helps. Feel free to ask questions.
Right, I'm off to take a look at this tcp code that's been posted by jtevermore
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
@jtevermore
Sorry, but I always get blue moving LEDs independend of whether I'm connected or not. (As I wrote in my previous post, I'm connected via peer to peer network (+switch) with a internet gateway computer (DSL)).
Nothing happens when I switch off the internet connection at the gateway
BTW, I've assigned a static IP, maybe that's the cause?
I cant thank you enough for your very lucid explanation of a method of 'Check for Updates'. I will give it a try.
Thanks again.
Mike
No problem. I hope my explanation was helpful. Ask more questions if I was unclear
Jase
www.slideshowdesktop.com
View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows....
If you don't want to ping, you only want to check for a connection from a computer to another computer (LAN or WAN), you can use the following code (unfortunately no support for Win95; but only for Win98 or higher, Win NT4 or higher).
if ( uResult == NO_ERROR )
{
for ( i = 0; i < pMIBTable->dwNumEntries; i ++ )
{
if ( pMIBTable->table[i].dwType != MIB_IF_TYPE_LOOPBACK )
{
if ( pMIBTable->table[i].dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED
|| pMIBTable->table[i].dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL )
{
bConnected = true;
}
}
}
}
delete[] pBuffer;
return 0;
}
Sorry, but if you have two computers, one connecting to the internet through the another, and you check the state on the computer which is not directly connected to the internet, the result MUST be connected if the computers are connected, and it is irrelevant the state of the internet connection on the other computer.
Don't forget that Internet Explorer has a home page, so it can easily check if the internet is available or not, since it will try to access the home page.
I found out later, that unfortunately the above code does not work as it should for NT/2K platforms, even if the function exists.
But I managed to solve to problem by using the gethostbyname function, which will attempt to resolve a DNS name of the site that has updates of the software. If it can not resolve the DNS name, than there is no IP connection.
And best of all, if you have a modem connection, it will not trigger the dialup screen.
* 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.