Getting Local IP of current machine (internet sockets)
I'm doing some application in C/C++ using pure berkeley sockets.
I want to know, what is the best way to get the adress from the current local machine, right now what I do is returning me 127.1.1.0, i want to have 192.168.0.100 for insntace
i gethostname() -> gives me my computer name ( marcd-linuxbox )
and then i create a hostent struct with the gethostbyname()
it works on Windows machine, probably because Windows is dumb, i found it more logical to have something like 127.0.0.1 or something like that returned. But i really need to find a way to get this local IP for my local network broadcast thingy.
Thanks for any help