Wednesday, 1 August 2007

DNS Programming

Today I've been continuing my foray into calling standard C library functions (at least I think that's what they're called) especially DNS-related ones such as gethostbyaddress, inet_addr, inet_ntoa from an RPG program.

Eventually found what I needed in Scott Klement's Socket Programming tutorial. Not an obvious place, but it's there nonetheless. I couldn't get gethostbyname to work until I trimmed all trailing blanks from the host name during the call.

Still have to sort out gethostbyaddr, that I did previously. Only seems to return one entry, sometimes a nonsense one. (I expect an array or a bunch of pointers). Even when I've solved that, I don't know how to choose the 'right' one.

No comments: