Hacer a la red Ping desde Visua Basic
Hola con todos, quisiera saber cual es el comando o como debo hacer para controlar la red desde un programa en visual basic, es decir que el programa indique que maquinas responden al ping, asi sabre si todas las maquinas estan en la red o no.
Por ejemplo q tenga botones(cada uno representa una maquina), si la maquina no responde que el boton cambie a color rojo, caso contrario este en verde. Este programa debe ejecutarse cada cierto tiempo.
Espero me entiendan y alguien me ayude, gracias mil...
Por ejemplo q tenga botones(cada uno representa una maquina), si la maquina no responde que el boton cambie a color rojo, caso contrario este en verde. Este programa debe ejecutarse cada cierto tiempo.
Espero me entiendan y alguien me ayude, gracias mil...
tengo una forma sencilla de hacerlo, primero debes realizar un archivo .bat con el comando ping y la dirección IP a donde desees llegar, luego con el comando shell + la ruta del archivo .bat ejecutas el comando en msdos y listo
cualquier cosa mandame un mail a [email protected] y te mando codigo mas especifico
strComputer = "DIREC IP"
Set oShell = CreateObject("WScript.Shell")
stemp = oShell.ExpandEnvironmentStrings("%temp%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objName = objFSO.GetTempName
objTempFile = objName
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "cmd.exe /c ping -n 3 -w 1000 " & strComputer & " >" & stemp & "" & objTempFile, 0, True
Set objTextFile = objFSO.OpenTextFile(stemp & "" & objTempFile, 1)
Do While objTextFile.AtEndOfStream <> True
strtext = objTextFile.ReadLine
If InStr(strtext, "Reply from") > 0 Then
Computers = "true"
Else
If InStr(strtext, "Request timed out") > 0 Then
Computers = "false"
End If
End If
Loop
Set oShell = CreateObject("WScript.Shell")
stemp = oShell.ExpandEnvironmentStrings("%temp%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objName = objFSO.GetTempName
objTempFile = objName
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "cmd.exe /c ping -n 3 -w 1000 " & strComputer & " >" & stemp & "" & objTempFile, 0, True
Set objTextFile = objFSO.OpenTextFile(stemp & "" & objTempFile, 1)
Do While objTextFile.AtEndOfStream <> True
strtext = objTextFile.ReadLine
If InStr(strtext, "Reply from") > 0 Then
Computers = "true"
Else
If InStr(strtext, "Request timed out") > 0 Then
Computers = "false"
End If
End If
Loop
