Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FInd Active network connections
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Divers
Thread ID:
00985456
Message ID:
00985667
Vues:
30
>>Any one know how to find out what PC are logged on to a network. I want to access data on them , but if they ae not present , the system hangs while it tris to find the network connection.
>>
>>Any ideas
>>
>>Brian
>
>I think the easiest way would be to use:
>
>
>Anetresources(laComputers, 'YourDomain', 1)
>
>
>You can also use LDAP or WMI, but if you only need the name of the computers, I would go with the native function.


Well I missed the hanging part. You can try to ping them before working with them (Only for Windows XP or +):
function Ping(tcTarget)
lparameters tcTarget
local lcTarget, loWMI, loPingStatus, llResponded

if Vartype(tcTarget) # 'C'
	return .F.
endif

lcTarget		= strtran(Alltrim(tcTarget), '\', '')
try
	loWMI			= GetObject("winmgmts:")
	loPingStatus		= loWMI.Get("Win32_PingStatus.Address='" + lcTarget + "'")
	llResponded		= loPingStatus.StatusCode = 0
catch
	llResponded		= .F.
endtry

return llResponded
So you can do something like:
local laComputers(1), lnComputers, lnComputer

lnComputers = Anetresources(laComputers, 'YourDomain', 1)
for lnComputer = 1 to lnComputers
    if Ping(laComputers[lnComputer])
         * Do your stuff
    endif
next lnComputer
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform