On Wed, Nov 03, 2010 at 11:25:49AM +1000, James Mills wrote: > Been looking around the web for how you might resolve hostnames on Mac > OS X using OS X's sys calls to do so. > > Can anyone shed any light on this ?
Try socket.gethostbyname for IPv4-only or socket.getaddrinfo for IPv4/IPv6. For example: >>> import socket >>> socket.gethostbyname('mary.local') '192.168.71.1' >>> socket.getaddrinfo('bookworm.griley.members.mac.com', None, >>> socket.AF_INET6, socket.SOCK_STREAM) [(30, 1, 6, '', ('fda1:5f1b:430f:37cc:214:51ff:fe0b:d94', 0, 0, 0))] Check the Python docs (http://docs.python.org/library/socket.html) for information on the tuples returned by getaddrinfo. -- Nicholas Riley <njri...@illinois.edu> _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG