ExamineIPAddresses() on OSX
Posted: Thu Jun 04, 2015 3:21 pm
Bit of a weird one, this. I have two Macs - a Mac mini and an iMac, both late 2012 vintage. Both running the current Yosemite (10.10.3).
On one of them (where I have pb 5.31 and xcode installed), ExamineIPAddresses() works and allows me to list the available (ipv4) IP addresses. On the other, ExamineIPAddresses() returns 0, which tells me it didn't work, but gives no indication as to why it didn't work. (And, yes, I've called InitNetwork() first).
Both machines have wired connections to the same switch and have IP addresses (as reported via ifconfig) on the same subnet.
Some code that reproduces the problem (on one mac but not the other):
I've compiled the above and run the resulting binary on both Macs. One reports the IPs correctly, the other prints "ExamineIPAddresses returned 0" to the terminal.
Anyone any ideas as to what could cause that? Or how to get more diagnostic info?
As a fallback, I've tried using RunProgram("ifconfig", "en0") and parsing the output, and I can read the IP successfully that way, but that's a horrible hack...
On one of them (where I have pb 5.31 and xcode installed), ExamineIPAddresses() works and allows me to list the available (ipv4) IP addresses. On the other, ExamineIPAddresses() returns 0, which tells me it didn't work, but gives no indication as to why it didn't work. (And, yes, I've called InitNetwork() first).
Both machines have wired connections to the same switch and have IP addresses (as reported via ifconfig) on the same subnet.
Some code that reproduces the problem (on one mac but not the other):
Code: Select all
OpenConsole()
InitNetwork()
result=ExamineIPAddresses()
If result
Repeat
ip=NextIPAddress()
if ip
PrintN("IP: "+IPString(ip))
endif
Until ip=0
Else
PrintN("ExamineIPAddresses returned 0")
EndIfAnyone any ideas as to what could cause that? Or how to get more diagnostic info?
As a fallback, I've tried using RunProgram("ifconfig", "en0") and parsing the output, and I can read the IP successfully that way, but that's a horrible hack...