Valhalla Legends Forums Archive | C/C++ Programming | DNS domain to ip chain, Seeking help - C++

AuthorMessageTime
LordVader
Have an idea for a  handy util for bots or any client application that connects to servers, but im unsure of the core functions that i'd need.. any idea's welcome..

Core program would do the following:
Input Domain(or ip), then dns the domain/ip then store the results in ini under:
[code]
[server=<domain>]
<domain>ip0=127.0.0.1
<domain>ip1=127.0.0.2
<domain>ip2=127.0.0.3
[/code]
or similar etc..

basic socket/connecting, and config writing, is no big deal can manage that..
Mainly curious about methods|ideas to retrieve ipchains from say useast.battle.net etc..
August 19, 2005, 7:16 AM
UserLoser.
[quote author=LordVader link=topic=12570.msg124693#msg124693 date=1124435810]
Have an idea for a  handy util for bots or any client application that connects to servers, but im unsure of the core functions that i'd need.. any idea's welcome..

Core program would do the following:
Input Domain(or ip), then dns the domain/ip then store the results in ini under:
[code]
[server=<domain>]
<domain>ip0=127.0.0.1
<domain>ip1=127.0.0.2
<domain>ip2=127.0.0.3
[/code]
or similar etc..

basic socket/connecting, and config writing, is no big deal can manage that..
Mainly curious about methods|ideas to retrieve ipchains from say useast.battle.net etc..
[/quote]

gethostbyname.  Loop through h_addr_list of your hostent structure, use inet_ntoa to convert it into a more readable format, and finally using whatever method you wish, write the ini file.
August 19, 2005, 11:48 AM
LordVader
[quote author=UserLoser link=topic=12570.msg124695#msg124695 date=1124452105]
gethostbyname.  Loop through h_addr_list of your hostent structure, use inet_ntoa to convert it into a more readable format, and finally using whatever method you wish, write the ini file.
[/quote]

Brainfart on my part, didn't look at  h_addr_list in gethostbyname, inet_ntoa looks handy will probably use that thx UL

*General Note:
For ip dns can use: gethostbyaddr then gethostbyname can be used.
August 19, 2005, 1:15 PM
Kp
Note that inet_ntoa is deprecated in favor of the more versatile inet_ntop.
August 19, 2005, 10:06 PM
UserLoser.
[quote author=Kp link=topic=12570.msg124719#msg124719 date=1124489191]
Note that inet_ntoa is deprecated in favor of the more versatile inet_ntop.
[/quote]

Pretty sure he's using Windows though :P
August 20, 2005, 4:41 AM
Kp
[quote author=UserLoser link=topic=12570.msg124755#msg124755 date=1124512917][quote author=Kp link=topic=12570.msg124719#msg124719 date=1124489191]Note that inet_ntoa is deprecated in favor of the more versatile inet_ntop.[/quote]Pretty sure he's using Windows though :P
[/quote]

Note that Windows is deprecated in favor of a more POSIX-compliant OS. ;)
August 20, 2005, 5:06 AM

Search