Resolving IP Addresses
No, inet_addr() will only translate a dotted ip address. If the string you pass it isn't a valid ip address then it will return INADDR_NONE. You should check for this value, and then use gethostbyname or (if you're using asyncronous sockets anyway) WSAAsyncGetHostByName to resolve the name using DNS.
Information about all the functions can be found in the winsock documentation or on msdn (msdn.microsoft.com).
Winsock API documentation is here.
WSAAsyncGetHostByName is here.
inet_addr is here.
EDIT:
For general winsock information, I suggest you look at the winsock FAQ.
Hope that helps,
John B
[edited by - JohnBSmall on April 19, 2003 11:37:36 AM]
Information about all the functions can be found in the winsock documentation or on msdn (msdn.microsoft.com).
Winsock API documentation is here.
WSAAsyncGetHostByName is here.
inet_addr is here.
EDIT:
For general winsock information, I suggest you look at the winsock FAQ.
Hope that helps,
John B
[edited by - JohnBSmall on April 19, 2003 11:37:36 AM]
I know the gethostbyname SHOULD work, but it does not seem to. The ones I am trying to get it to work for is:
xtac.kicks-ass.net
or
xtac.serveftp.net
or
mqonline.homeftp.net
They all point to the same IP address. Ping them, and it works just fine, but I cannot do much else. I do not want to use WSAAsync* functions right now, because I am just doing stuff with the console.
xtac.kicks-ass.net
or
xtac.serveftp.net
or
mqonline.homeftp.net
They all point to the same IP address. Ping them, and it works just fine, but I cannot do much else. I do not want to use WSAAsync* functions right now, because I am just doing stuff with the console.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement