Translating IP address on a local network

Sarah Reichelt sarah.reichelt at gmail.com
Thu May 1 20:56:11 EDT 2008


>  We have a small network behind a NAT router, with IP addresses either
>  set manually or by DHCP in the format 192.168.1.xxx.
>  All the computer's are Macs so they also have Bonjour names e.g.
>  sarah-mac.local.
>
>  I have set up a custom web server based on Andre's RevOnRockets. When
>  the web server receives a request, the IP address of the requesting
>  computer is contained in the socket ID. I would like to be able to
>  translate that to the Bonjour name of the requesting computer as that
>  would make the logs much more easily read.
>
>  Is there a Mac shell command or any way of getting this data for
>  addresses inside a local network which are not listed on any DNS or
>  Directory service?


I'm testing a method that works backwards. I use mDNS to give me a
list that contains the computer names. Then if I convert these names
to Bonjour names, I can ping then, which always gets the IP address
from the name. Then I can store that data in a lookup table to use for
converting IP addresses back to names.

I made this into a standalone and it works fine. So then I set up a
crontab entry to have the app run once a day. It runs fine and mDNS
gets the list of networked computers, but ping just returns "/bin/sh:
line 1: ping command not found". However on the same computer when I
run the app manually, it works perfectly.

There must be something happening when the app runs as a cron job that
is messing with it's mind. Hopefully someone with a better grasp of
cron than me, can come up with a solution.

Cheers,
Sarah



More information about the use-livecode mailing list