I am running an application program that would like to determine its current IP address. In the LITE5200B boards, that information is saved as an “environmental variable”, but I don’t believe the environmental variable is available when I boot from FLASH. My build file has already executed an “ifconfig en0 inet 192.168.1.11” when my application starts running, but I have not been able to find a way to get my IP address. Probably something simple…
Any suggestions or references to a particular document would be appreciated. Thanks!
The solutions I’ve seen on the Internet over the last couple of days use gethostname and gethostbyname, which ultimately try to read the /etc/hosts file - which I do not have on my embedded controller. My hope was that QNX would have some other way of doing it internally. A coworker suggested spawning an “ifconfig” and parsing the IP address out of that!
I have the workaround of creating a variable in my build script that my application can access, so I may just stick with that.