nend 45 Posted December 11, 2020 Hi, I have made small program which is collecting data from a device on my local network by using inetread. This devive uses mDNS and can be approached by using this adres "http://name.local", this works ok. Can I find what's the IPadress from this device by using Inetread, to use every it's collecting data, by using mDNS everytime it's slow and I want to use the IPadres after the first time connecting. If there is a other sollution to get the IPadres of a device using mDNS. I've search a long time for it but can't find a working sample in AutoIT how collect the IPAdres from a mDNS/Bonjour device. Share this post Link to post Share on other sites
Nine 993 Posted December 11, 2020 Have you tried TCPNameToIP ? Not much of a signature but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Multi-keyboards HotKeySet Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
nend 45 Posted December 11, 2020 I have tryd it but it won't work. TCPNameTOIP uses dns and will not work on mDNS Share this post Link to post Share on other sites
pseakins 20 Posted December 11, 2020 I assign each device on my local network a fixed IP via static lease DHCP settings in my router. Do this, then you can just hard code the address and forget about it. Phil Seakins Share this post Link to post Share on other sites
TheXman 405 Posted December 11, 2020 (edited) Since you are dealing with the HTTP protocol, if you aren't inextricably tied to using InetRead(), then you could easily replace InetRead with a simple CURL command. In order to retrieve the HTTP request content and/or get the remote IP address, you could run the following command and capture the stdout output: ;The following line will get the http response and the remote IP address curl -sL -w "\r\nRemote IP = %{remote_ip}\r\n" http://name.local or ;The following line will just get the remote IP address curl -sL -o nul -w "\r\nRemote IP = %{remote_ip}\r\n" http://name.local The remote IP address will be appended to the end of the output on a separate line. Once you download the 32-bit and/or 64-bit CURL for Windows executable, you can open a command console and run the commands to see the output for yourself. Then you can translate the running and capturing of the command and its output into an AutoIt script. FYI: The above curl command's parameters are:-s = run silent, no progress info-L = Follow redirects (not really necessary in your case, but useful otherwise)-o = Write the response output to the following file-w = Write the following string to the output If you need more information on CURL, read the CURL Documentation. Edited December 11, 2020 by TheXman About TheXman | CryptoNG UDF - Cryptography API: Next Gen | HttpApi UDF - HTTP Server API | jq UDF - Powerful and Flexible JSON Processor Share this post Link to post Share on other sites
GokAy 60 Posted December 11, 2020 17 minutes ago, pseakins said: I assign each device on my local network a fixed IP via static lease DHCP settings in my router. Do this, then you can just hard code the address and forget about it. Not all routers have an option to reserve an IP address in it's DHCP server. Share this post Link to post Share on other sites
nend 45 Posted December 12, 2020 (edited) @TheXman, thanks for the reply but I want it in AutoIt code. I found a link which made it possible but it has a lot of functions which I don't need so I striped the UDF and made a new one from it Link from the "DIG" from which I made this UDF I attach it if some one needs it, It's only returning the IPadres of the mDNS/bonjour device. expandcollapse popupConsoleWrite(_mDNS("http://Diskstation.local") & @CRLF) Func _mDNS($domain) Local $return_ip, $domain_convert, $mDNS_msg $domain = StringReplace($domain , "http://", "") Local $domain_array = StringSplit($domain, ".") For $i = 1 To $domain_array[0] $domain_convert = $domain_convert & Hex(BinaryLen($domain_array[$i]), 2) & StringTrimLeft(StringToBinary($domain_array[$i]), 2) Next UDPStartup() Local $mDNS_sock = UDPOpen("224.0.0.251", 5353) If @error Then UDPShutdown() SetError(1) Return "" EndIf Local $query_time = TimerInit() UDPSend($mDNS_sock, "0x5A8901000001000000000000" & $domain_convert & "0000010001") Do $mDNS_msg = UDPRecv($mDNS_sock, 512, 1) Sleep(100) Until $mDNS_msg <> "" Or TimerDiff($query_time) > 1000 UDPShutdown() For $i = 3 To 0 Step -1 $return_ip = $return_ip & Dec(StringMid(BinaryMid($mDNS_msg, BinaryLen($mDNS_msg) - $i, 1), 3)) If $i <> 0 Then $return_ip = $return_ip & "." EndIf Next Return $return_ip EndFunc Edited December 12, 2020 by nend Share this post Link to post Share on other sites