j0kky Posted October 22, 2014 Share Posted October 22, 2014 Hi guys, I need to know, if anyone knows, when the macro @IPAddress1 returns 127.0.0.1 (as documentation says), if the real LAN IP (ex 192.168.x.x) is always returned by @IPAddress234. The problem exists if the PC is connected to the LAN, @IPAddress1 returns 127.0.0.1 but no macro returns the real IP. It would be useful to know which API is called by @IPAddress1, I suspect GetAdaptersInfo but I'm not sure. Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
JohnOne Posted October 22, 2014 Share Posted October 22, 2014 Perhaps when you have a local proxy server. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jguinch Posted October 22, 2014 Share Posted October 22, 2014 ProcessMonitor shows Iphlpapi.dll is not used. But mswsock.dll is used, so it can be a Winsock function like getaddrinfo() Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
j0kky Posted October 22, 2014 Author Share Posted October 22, 2014 (edited) @JohnOne: So if I have a local Proxy server can it happens: @IPAddress1 = 127.0.0.1 @IPAddress2 = 0.0.0.0 @IPAddress3 = 0.0.0.0 @IPAddress4 = 0.0.0.0 @Jguinch: Thank you! Probably it uses getaddrinfo or the old gethostbyname + inet_ntoa Edited October 22, 2014 by j0kky Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
jguinch Posted October 22, 2014 Share Posted October 22, 2014 instead, you can use a (slow) WMI query : #Include "Network.au3" ; in my signature Local $aInfos = _GetNetworkAdapterInfos() For $i = 0 To UBound($aInfos) - 1 If $aInfos[$i][16] <> "" Then ConsoleWrite($aInfos[$i][8] & @TAB & $aInfos[$i][16]) Next Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
j0kky Posted October 22, 2014 Author Share Posted October 22, 2014 @jguinch: sorry but I prefer to not use WMI because I don't want to require admin rights. Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
JohnOne Posted October 22, 2014 Share Posted October 22, 2014 I'm unsure of the question now. Are you saying that the macro returns the loopback address for you? Are you after external IP address? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
j0kky Posted October 22, 2014 Author Share Posted October 22, 2014 (edited) @JohnOne: I'm bulding a LAN chat, I don't care about WAN address (external IP) but I'm looking for the current LAN address. @IPAddress returns for me the right LAN address but, as documentation says, in certain cases @IPAddress1 reports the loopback address 127.0.0.1. My question is: in those cases, can I be sure that the other IPAddress macros report the real LAN address 192.168.x.x ? EDIT: Obviously the question is related to a PC inserted in a LAN. Edited October 23, 2014 by j0kky Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
JohnOne Posted October 23, 2014 Share Posted October 23, 2014 Tricky one to answer that, and I imagine only a code dev could really answer it. I get the feeling that the help file comment could be be a throwback from the win9x.ME days, but I obviously cannot be certain of that, I have never come across the macro returning loopback address. I fear that you might have to actually have access to such a case machine to determine and address any potential bugs, other than looping through the macro's and testing for a valid address. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jguinch Posted October 23, 2014 Share Posted October 23, 2014 @j0kky : WMI doesn't need admin rights for this read operation. _GetNetworkAdapterInfos() works with a standard account. But I agree, it's less clean than an integrated function or a WinAPI based one... Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
j0kky Posted October 23, 2014 Author Share Posted October 23, 2014 (edited) @JohnOne and Jguinch: thank you for your time, I can't access to a win9x PC but MSDN says: IPConfig This directory contains a sample program that demonstrates how to programmatically retrieve IPv4 configuration information similar to the IPCONFIG.EXE utility. It demonstrates how to use the GetNetworkParams and GetAdaptersInfo functions. Note that the GetAdaptersInfo function only retrieves IPv4 information. So I think I will loop trought the macro searching a valid address, if no result I'll implement a GetAdaptersInfo-based snippet. Edited October 23, 2014 by j0kky Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
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