"Muli B.Y." wrote:
> 
> Thanks for the suggestions, Nimrod, I have implemented the
> online/offline thing this way. Shame on me for not having read the FAQ
> (where this stuff is mentioned) for quite some time.
> 
> Nevertheless, it was a good excersize and my original question stands:
> Windows has RasConnectionNotification(). What does linux have except
> constant polling?

Oh well.. seems like I have to correct myself again ;)

Linux *does* support such notifications. Kernel 2.2 introduced Netlink
sockets and routing messages (these are compile-time options - look at
the networking options when you compile your kernel).

Your process will be notified of any routing table changes, interface
up/down events, etc. I believe you can ask to be notified of certain
events only. Not sure, though. It looks a bit complicated, and
definitely lacks good documentation but have a look at the 'iproute2'
package for an example. Get it from:

ftp://ftp.inr.ac.ru/ip-routing/

build it and try (as root):
/ip monitor all  

now try on another terminal: '/sbin/ifconfig lo down' and look at the
monitor's output.

Still, it's a complicated solution and the process has to have NET_ADMIN
capabilities or root uid. Seems like this interface was designed
primarily for routing daemons.

-- Nimrod.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to