Quoting Conrado Badenas ([EMAIL PROTECTED]): > Does anyone know how to obtain hostnames (e.g., skywalker.termol.uv.es) > from IP addresses (e.g., 147.156.6.236). I've written this program: > [...]
> int l; > char addr[]="147.156.6.236"; > struct hostent *ph; > > l=strlen(addr);ph=gethostbyaddr(addr,l,AF_INET); You can do that sort of thing nicely in a language like Python because it takes care of the structures for you. In C you've got to do it all yourself. The value of l must be four, and addr should be a pointer to an in_addr structure in network byte order. > Is there any program (like a filter: input address in stdin, output name > in stdout) that could do it? I've tried with nslookup but doesn't work > (and it worked last month). nslookup works here today. But I find python ideal for playing around with these sorts of things. Elegant and easy. Cheers, -- Email: [EMAIL PROTECTED] Tel: +44 1908 653 739 Fax: +44 1908 655 151 Snail: David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA Disclaimer: These addresses are only for reaching me, and do not signify official stationery. Views expressed here are either my own or plagiarised.