Deye Posted August 30, 2017 Posted August 30, 2017 Hi, i.e using $sIPAddress = TCPNameToIP("http://example.ddns.net") got me error: 11004 WSANO_DATA which lead me to look for "gethostbyname" Can this function can be tweaked to work along giving it an address parameter ( presuming it can also work from out side IPs ) Running it locally with the private network address ..worked! ; https://www.autoitscript.com/forum/topic/165201-dllstructcreate-alignment-problem/?do=findComment&comment=1206048 Func _hostbyname($sAddress) TCPStartup() $pointer = DllCall("Ws2_32.dll", "ptr", "gethostbyname", "str", "") $pointer = $pointer[0] $hostent = DllStructCreate("ptr h_name; ptr h_aliases; short h_addrtype; short h_length;ptr h_addr_list", $pointer) $sh_addr_list = DllStructCreate("ptr", DllStructGetData($hostent, "h_addr_list")) ;We get the Pointer to an array of addr $inaddr = DllStructCreate("ptr", DllStructGetData($sh_addr_list, 1)) ;we get the array[0] ;if you want to get another index just plus 4 $uint = DllStructGetData($inaddr, 1) $ret = DllCall("Ws2_32.dll", "str", "inet_ntoa", "UINT", $uint) Return $ret[0] TCPShutdown() EndFunc ;==>_hostbyname
jguinch Posted August 30, 2017 Posted August 30, 2017 "http://example.ddns.net" is not a host name Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Deye Posted August 30, 2017 Author Posted August 30, 2017 jguinch, Its an address that doesn't work for me with TCPNameToIP the function in question is for gethostbyname ..what else Thanks
TheDcoder Posted August 30, 2017 Posted August 30, 2017 @Deye As mentioned by @jguinch, example.ddns.net does not exist. It is the same as trying to get god.universe's IP address EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
Deye Posted August 30, 2017 Author Posted August 30, 2017 I take it this function maybe only good for getting the address's IP in case the requester has the same (external ip) ? what do you get when running TCPNameToIP() against your own ddns.net which is linked to the computer you are running the command off ? example.ddns.net is of course fake (i.e: example)
TheDcoder Posted August 30, 2017 Posted August 30, 2017 24 minutes ago, Deye said: what do you get when running TCPNameToIP() against your own ddns.net which is linked to the computer you are running the command off ? What is ddns.net? EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
Deye Posted August 30, 2017 Author Posted August 30, 2017 Use of Dynamic DNS needs an implementation .. Anyone, please confirm do you get any ip for this address: MsgBox(0,"", TCPNameToIP("http://scriptlistener.ddns.net"))
TheDcoder Posted August 30, 2017 Posted August 30, 2017 Your dynamic DNS address will always point towards the host computer's external IP address. 2 minutes ago, Deye said: Anyone, please confirm do you get any ip for this address: You should remove http:// because its a protocol identifier used by browsers, domain names don't need any protocol to associate with. I tried your snippet, and here is the result: Deye 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
Deye Posted August 30, 2017 Author Posted August 30, 2017 Well then that explains to me = trouble at its absence Thanks again for all the great help !
jguinch Posted August 30, 2017 Posted August 30, 2017 It's what I said : "http://example.ddns.net" is not a host name ... Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now