Rob Chartier ~ Contemplation...

.NET, C#, Work, etc.

News






www.flickr.com
This is a Flickr badge showing public photos from Rob & Kat Chartier. Make your own badge here.


Even Quicker Links

October 2004 - Posts

IE's sensapi.dll IsNetworkAlive() ?

A coworker pointed me to this post by Ying-Shen Yu [MSFT].

I decided to copy his comment in full, just incase google drops it or you dont feel like hitting that link above.

----

In my further research, both APIs have their limitations(e.g. IsDestinationReachable depends on if the server would respond to Ping), so if you have problem in using these APIs, maybe you can try using TcpClient class and connecting to that web service first to see if the service is available, when your application starting up.

----

I also grabbed his code and created a handly little class.

----

(create a new C# Class library)

using System;
using System.Runtime.InteropServices;

namespace Sense {
    public class API {
        private static int NETWORK_ALIVE_LAN = 0x00000001;
        private static int NETWORK_ALIVE_WAN = 0x00000002;
        private static int NETWORK_ALIVE_AOL = 0x00000004;
        public static bool IsLanAlive() {
            return IsNetworkAlive(ref NETWORK_ALIVE_LAN);
        }
        public static bool IsWanAlive() {
            return IsNetworkAlive(ref NETWORK_ALIVE_WAN);
        }
        public static bool IsAOLAlive() {
            return IsNetworkAlive(ref NETWORK_ALIVE_AOL);
        }
        public static bool IsDestinationAlive(string Destination) {
             return (IsDestinationReachable(Destination,IntPtr.Zero));
        }
        [DllImport("sensapi.dll")]
        private extern static bool IsNetworkAlive(ref int flags);
        [DllImport("sensapi.dll")]
        private extern static bool IsDestinationReachable(string dest,IntPtr ptr);
    }
}

----

And finally useage (create a new Console app):

while(true) {
    Console.WriteLine("Lan:"+Sense.API.IsLanAlive());
    Console.WriteLine("Wan:"+Sense.API.IsWanAlive());
    Console.WriteLine("Aol:"+Sense.API.IsAOLAlive());
    Console.WriteLine("Sip:"+Sense.API.IsDestinationAlive("www.microsoft.com"));
    System.Threading.Thread.Sleep(1000);
}

Let it run for a few seconds and then yank your network cable. 

EDIT:

Found the related docs on MSDN.

 

Posted: Oct 21 2004, 10:59 AM by Rob Chartier | with no comments
Filed under:
Which File Extension Are You?
You are .swf You are flashy, but lack substance. You like playing, but often you are annoying. Grow up.
Which File Extension are You?
Posted: Oct 21 2004, 10:49 AM by Rob Chartier | with no comments
Filed under:
Halo, your not the only one. GTA: SA Theft

Grand Theft Auto: San Andreas is the latest victim.

Here and Here

I would be interested to see what Bungie (Microsoft) and Rockstar are going to be doing about this.  Internal security is probably going to jump 10 fold.

 

Posted: Oct 21 2004, 10:41 AM by Rob Chartier | with 1 comment(s)
Filed under:
Halo 2 leaked onto the internet (NNTP)

Microsoft has said it is trying to track down the people behind a pirated copy of the forthcoming Halo 2 game.

 

Read More

Got an XBOX...

I'm one of those non-gamer IT guys.  I finally decided to get an XBOX today, mostly because my fiance (Kat) called me up and said she felt like playing arcade games and the only games I had to offer were some simple Flash based games which we downloaded off some random sites.  So I said to heck with it and ran to the local mall and grabbed one. 

More expensive than I thought it would be but then again I should have shopped around.  It shipped with "Top Spin" which includes a super lame snowboarding and tennis game.  The store I purchased it from had a special that if you buy an accessory you get a game free which since I needed 2 controllers I went for it.  I grabbed another controller and the DVD pack.  The free game was Unreal II.

I surprised the fiance with the XBOX and she was excited to play.  A few hours later, just past midnight we decided to call it a night.  Made it pretty farm in the Unreal game. 

Cant wait to play Halo.  I think I have played that game about 3 times in total, and all at DevLabs on MSFT campus.  Kat usually kicks my ass in the shoot'em up kind of games so it will be fun.

 

What other games do you guys recommend?

 

Dont forget to update Microsoft Office...

Just a quick reminder to make sure you update your installation.

http://officeupdate.microsoft.com

 

[MVP] Congratulations! You have received the Microsoft MVP Award

This just in...

Dear Rob Chartier,

Congratulations and Welcome to the Microsoft MVP Program!

As a recipient of this year’s Most Valuable Professional award, you join an elite group of individuals in online and offline technical communities around the world who share their passion for Microsoft products and technologies with others. Microsoft® salutes all MVPs for promoting the spirit of community by helping other people realize their potential through technology. To learn more about the MVP Program, visit: www.microsoft.com/mvp.

Your extraordinary efforts guiding your peers in Visual Developer - ASP/ASP.NET technical communities during the past year are greatly appreciated. The benefits you will enjoy as part of the MVP Program are outlined below.

...

 

More Posts