Re: StartupItem info: Laptop Network Starting
Re: StartupItem info: Laptop Network Starting
- Subject: Re: StartupItem info: Laptop Network Starting
- From: Stefan Arentz <email@hidden>
- Date: Mon, 1 Apr 2002 22:52:12 +0200
On Sun, Mar 31, 2002 at 03:54:21PM -0600, The Doctor What wrote:
>
I have an application that needs to be run *after* the network is
>
brought up and has an IP and DNS Servers, etc.
>
>
I would just drop it in /Library/StartupItems with a plist that requires
>
Network and NetworkConfiguration. But that seems to only require that
>
the network system be running.
>
>
In my case (I have a laptop), if I start the laptop without ethernet,
>
then my application will run, but won't connect to the remote server.
>
>
This is a large part of the point of my application, since it tracks the
>
ip address of the laptop as it moves around.
>
>
I would think that *something* in OS X must know about when the network
>
goes up and down and could tell my application, but I'm having a hard
>
time finding it.
You can open a routing socket and check if the default route changes. The
routing sockets are described in UNIX Network Programming by Stevens. You
basically open a socket and read messages from it. When you see that the
default route is added or changed then you know that a connection with a
new network has been made.
Stefan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.