Marcus Meissner wrote:
I spent some thought, and detecting how the computer is connected is not trivial under Linux. You would need to parse either ifconfig -a output or /proc/net/dev under Linux, then check for packets transmitted, interface up/down status etc. This would be an ifdef and stringparsing hell.
How about looking at the output of the route command (or /proc/net/route) and seeing if there is a default route present?
Berend