[REBOL] How to get allocated ip number
From: michel:goasampis:free at: 15-Oct-2002 21:55
Hi all,
excuse my bad english...
I need to manipulate the ip number my PC obtain from the provider when
connect to internet.
To get it, I hack something with the 'get-modes function which give this
result on my linux pc :
>>probe get-modes tcp:// 'interfaces
[
make object! [
name: "lo"
addr: 127.0.0.1
netmask: 255.0.0.0
broadcast: none
dest-addr: none
flags: [loopback]
]
make object! [
name: "eth0"
addr: 192.168.1.118
netmask: 255.255.255.0
broadcast: 192.168.1.255
dest-addr: none
flags: [broadcast multicast]
]
make object! [
name: "ppp0"
addr: 62.147.73.189
netmask: none
broadcast: none
dest-addr: 192.168.254.254
flags: [multicast point-to-point]
]]
so I do :
all-interfaces: get-modes tcp:// 'interfaces
internet-interf: all-interfaces/3
my-ip: copy to-string internet-interf/addr
but it isn't verry elegant, and does'nt work on all pc (if more or less interfaces are
found).
Please help me, I hope there is a more efficient way like
my-ip: copy some/voodoo/path...
Thank-You
Michel, newbie but addicted