Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I'm writing a simple program to convert an IP address to a hostname, but I'm having trouble with the function GetHostByAddr (found in winsock.h (windows) or netdb.h (linux/unix)). The function takes three arguments (const char FAR * addr,int len, int type) len=4 and type=AF_INET. I've tried simply passing a string (ie: "127.0.0.1") as the addr argument, but it doesn't work. I think it wants the address in network byte order but I can't figure it out. If you have an idea what the problem is (or source code, or a suggestion) please tell me. I will post my source in my next message.