I'm currently using the following code to read the stdout stream of the NET command and using the parameter 'view' (which lists all computers in the current domain.) My question is, what is the best approach to finding the connected computers on the LAN. Any help is much appreciated. Thanks. Function & Example: (working code) #include <Array.au3>
#include <Constants.au3>
TCPStartup()
Local $aArray = _GetNetView()
_ArrayDisplay($aArray)
TCPShutdown()
Func _GetNetView() ; Based on the idea by AoRaToS: http://www.autoitscript.com/forum/topic/78672-lan-chatting-help-needed/page__view__findpost__p__568770
Local $aError[1][2] = [[0, 2]], $iPID = Run(@ComSpec & ' /c net view', '', @SW_HIDE, $STDOUT_CHILD), $sOutput = ''
While 1
$sOutput &= StdoutRead($iPID)
If @error Then
ExitLoop
EndIf
WEnd
Local $aArray = StringRegExp($sOutput, '([0-9a-zA-Z-]*)', 3)
If @error Then
Return SetError(@error, 0, $aError)
EndIf
Local $aReturn[UBound($aArray, 1) + 1][2] = [[UBound($aArray, 1), 2]]
For $i = 0 To $aReturn[0][0] - 1
$aReturn[$i + 1][0] = StringStripWS($aArray[$i], 3)
$aReturn[$i + 1][1] = TCPNameToIP($aReturn[$i + 1][0])
Next
Return $aReturn
EndFunc ;==>_GetNetView