Función para verificar el estado de la red Visual Basic .Net

La siguiente función realiza las pruebas básicas para saber si nuestro equipo mantiene una conexión a Internet.

Referencia

Imports System.Net

Código

Public Function EstadoRed() As Boolean

        Try

            If My.Computer.Network.IsAvailable() Then
                If My.Computer.Network.Ping("www.google.cl", 1000) Then 'Asignamos la pagina a consultar ejemplo www.google.cl y el tiempo de espera máximo
                    EstadoRed = True
                Else
                    EstadoRed = False
                End If
            Else
                EstadoRed = False
            End If

        Catch ex As Exception
            EstadoRed = False
        End Try

    End Function

Esperamos sea de su utilidad,

Saludos

También te podría gustar...

2 Respuestas

  1. LUIS dice:

    YO USO ESTO:

    Do
    ping1 = My.Computer.Network.Ping(«8.8.8.8», 1000)
    Loop Until ping1 = True

  2. I as well as my friends appeared to be analyzing the nice recommendations on your web site then at once got a terrible feeling I never thanked you for those tips. The boys had been so glad to study them and already have seriously been enjoying those things. We appreciate you truly being indeed accommodating and also for deciding on this sort of notable topics millions of individuals are really desperate to be informed on. My sincere apologies for not expressing gratitude to sooner.

Deja una respuesta

Tu dirección de correo electrónico no será publicada.