How can I get ip add开发者_Python百科ress with C/glib of my local computer which get from route.
I'm not really sure what you mean with "get from route".
But if want to get the IP you're using outside your LAN then just wrap up this command into a system call.
curl -s http://myip.dk/ | egrep -m1 -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
It always works.
You can use libgtop, in particular you can use a mix of netlist and netload. With netlist you can get the network interface list, and with netload you can get the information for each interface (or the interface you are interested in).
精彩评论