So I'm trying to get the LAN IP Address of the machine the program is running on and compare it to IP Addresses passed to it via UDP.
However when I use:
print str(socket.gethostbyname(socket.gethostname()))
It returns 127.0.0.1 which should be 192.168.1.9.
I've looked through the linux machine and its getting the IP Address of the lo (loopBack) port? I don't know exactly what that is but it should be getting the IP Address of eth0.
I've found that I can subprocess the bash command "ifconfig eth0" but that returns a big block of a string. I can process it down to what I need, but this is going to be running around 3 times a second on a beaglebone so I'd like it to be a little more effecient.
Is there a more elegant way of doing this?
Can I just change the target of gethostname?
Why is it targeting the lo port?
Thanks for your help maners.