I need to display all the IP addresses from my local computer, using the C language. How can this be done?
相关问题
- Multiple sockets for clients to connect to
- Is shmid returned by shmget() unique across proces
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- how to get running process information in java?
Your question might be imprecise but I am not sure why everyone is breaking your chops.
I think you are asking the basics in which case you probably want is getifaddrs. The man page has a little example program.
You can also get similar info using the SIOCGIFCONF option with ioctl(). There is some sample code on here and the web.
If you search around for these and similar terms you will find this question has been asked in various forms before. You have to dig around a bit.
Also note, these will not give you the public facing IP of your network if you are behind NAT.