[Gambas-devel] [Gambas-devel-svn] SF.net SVN: gambas:[6374] gambas/trunk

Tobias Boege tobias at ...692...
Sun Jul 13 19:43:54 CEST 2014


On Sun, 13 Jul 2014, gambas at ...1... wrote:
> [GB.DESKTOP]
> * NEW: Desktop.NetworkAvailable is a new property that returns if the 
>   network is available. It just use 'ifconfig' to search for a network 
>   interface having an IP address different from '127.0.0.1'

The distributions I lookied at recently all came without "ifconfig" but
with the "ip" program instead. Maybe we should consider this alternative
setup. If it helps you to implement it:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet xxx.xx.xxx.xx/xx brd xxx.xx.xxx.xxx scope global eth0
       valid_lft forever preferred_lft forever
    inet6 xxxx::xxxx:xxxx:xxxx:xxxx/xx scope link
       valid_lft forever preferred_lft forever

To extract the IP addresses of all interfaces:

$ ip addr | egrep -o "inet [^/]+" | sed 's/inet \(.*\)/\1/'
127.0.0.1
xxx.xx.xxx.xx

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk





More information about the Devel mailing list