0

Is there any way to trigger an action as soon as I get connected to a network with a specific network interface i.e. local area connection 2? The OS is winXP. Thanks in advance

4 Answers 4

1

I think some NIC software might do that. I think I saw something about this in my dell NIC software.

0

I'm fairly certain there's no XP functionality to launch an app based on plugging in the cable.

This is straying into Stack Overflow territory, but it looks as if there are definitely WMI events that you can grab onto - though I'm uncertain about whether you can get to these without churning out some code. Here's an example.

0

Definitely worth asking this on Stack Overflow as well, because it's will have to be a programatic solution.

0

There are no built in applications that can do this that I'm aware of and I haven't come across any general purpose third party apps that do anything reusable.

If you have a developer handy you can roll your own. I've built a number of applications ( Windows 2000\XP so this should work for you) that use the IPHelper API's NotifyRouteChange function to register a callback that reacts to any change in the routing table. This has proven to be very reliable and rapid as it responds to things like connecting\disconnecting a LAN or WLAN as soon as the adapter's IP-address becomes usable. This is generally a couple of seconds after a cable is plugged in, at most. It is (obviously) limited to IP networks though.

The System Event Notification System (SENS) has mechanisms designed to be used for this purpose (specifically the ISENSNetwork::ConnectionMade Method) but my experience with this and other SENS functionality is that they can take minutes to trigger. This appears to be intentional as SENS is intended to provide applications with mechanisms to adjust their behavior to network state changes over time (e.g. degradation of link quality), rather than to provide instantaneous reactions such as a response to a new connection being made.

This probably does belong over on StackOverflow though.

You must log in to answer this question.