Network Interface Detection

Right now I’m working on detecting when network interfaces come and go, so that, for example, Psi can go online when your network connection becomes active. There is a nice debate as to what constitutes a network connection, but I think for our purposes I’ve decided this will be a non-loopback interface bound to a gateway. This code will be part of IrisNet, which is the new network subsystem for Iris.

Time for platform-specific coding fun again.

5 Comments »

  1. Norman Rasmussen said,

    January 30, 2006 @ 2:10 am

    Does this mean that when you bring your pc out of hibernate that it’ll try and login rather than looking at you funny? (A least with pre-0.10, it tried to reconnect)

  2. James Chaldecott said,

    January 30, 2006 @ 5:11 am

    Have you seen the System.Net.NetworkInformation.NetworkChange class in .NET 2.0?

    http://msdn2.microsoft.com/en-us/library/system.net.networkinformation.networkchange.aspx

    Could be a useful implementation reference (via Reflector).

  3. James Chaldecott said,

    January 30, 2006 @ 5:49 am

    A quick look with Reflector shows me that the interesting stuff happens in :

    System.Net.NetworkInformation.NetworkChange::AddressChangeListener.StartHelper()

  4. justin said,

    January 30, 2006 @ 2:16 pm

    Norman: I think waking from suspend may be a separate issue, since I don’t think the network interfaces actually go down/up during a suspend cycle (or it is OS dependent, at least). Maybe it does go down on your system, and is not back up by the time Psi tries to use it. You should look into it and report back.

    James: thanks for the tip

  5. James Chaldecott said,

    January 31, 2006 @ 6:29 am

    I posted the original Win32 patch (to Remko) for suspend/resume in cutestuff/SystemWatch. The intention was for Psi to disconnect & reconnect on sleep/wakeup.

    For some reason the reconnect is commented out at the moment (and from at least the initial Darcs import).

    void PsiCon::doSleep()
    {
    setGlobalStatus(Status(”",tr(”Computer went to sleep”),0,false));
    }

    void PsiCon::doWakeup()
    {
    // TODO: Restore the status from before the log out. Make it an (hidden) option for people with a bad wireless connection.
    //setGlobalStatus(Status());
    }

    BTW: I notice that “michalj” says he’s porting SystemWatch to Qt4 and including network status detection. Will this conflict with/replicate what you’re doing?

    http://forum.psi-im.org/post/24770
    http://forum.psi-im.org/post/24811

RSS feed for comments on this post · TrackBack URI

Leave a Comment

Bad Behavior has blocked 353 access attempts in the last 7 days.