Internet Communication / Windows Service

  • Thread starter Thread starter Doug Handler
  • Start date Start date
D

Doug Handler

Hello,

I'm hoping someone can help / provide me direction to support what I'm
trying to do. I'm interested in how Symantec's Norton Antivirus background
application runs. They have a separate application that runs (Windows
Service) that downloads from their website automatically (if set) the latest
virus definition file and applies it to their application. I'm looking for
this similar functionality for our application. Furthermore, I want to be
able to determine if the user is connected to the internet (via dialup or
broadband / dsl). If they are, then automatically run, if not, ask the user
if they want to connect (via dialup - figuring that broadband will be an
always on situation). Is there anything (3rd party components) out there
that does this or has all these pieces that I can use / put together? Or is
this something that I need to develop on my on? If so, then does anyone
have any direction / recommendation where I can start - documentation /
book?

Thanks in advance,
Doug
 
Doug,

Chances are there is not something like this pre-built.

The first feature you want is basically creating a generic engine that
is based on rules defined somewhere else. Norton basically has a file with
structured information in it, which the application then reads. A very
simple example is when you want to create a list of currencies in the world.
You don't hard code it into your app, you create a list, and then have a
generic routine that will process that type of list. When you have new
currencies (like when the Euro was introduced), you just update the list
appropriately, not your app.

The same concept applies here. To find updates, you have to publish
your list in a well known location (constant URL), and then you just have to
have some sort of checking that is peformed when your application is run, to
see if the contents are out of sync (perhaps comparing hashes would be a
good idea). If they are, download the new file, and then replace the old
one with it.

As for automatically connecting, you can call the
InternetGetConnectedStateEx function through the P/Invoke layer to determine
connectivity. Once you have that, if you need to connect, you can use the
InternetAutoDial function. Both can be found in the WinInet library.

Hope this helps.
 
Back
Top