Jump to content

Verificar conexão


Google
 Share

Recommended Posts

Existem API do Win onde podes ir buscar essa informação (como aliás alguém já pesquisou no teu nick, com toda a certeza).

Alternativamente podes utilizar a ideia do ping sem precisar de fugir da nossa beloved framework:

Public Class Form1
    Private WithEvents NW As New Net.NetworkInformation.Ping

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        NW.SendAsync("www.google.com", Nothing)
    End Sub

    Private Sub NW_PingCompleted(ByVal sender As Object, ByVal e As System.Net.NetworkInformation.PingCompletedEventArgs) Handles NW.PingCompleted
        Try
            MsgBox(e.Reply.Status.ToString)
        Catch
            MsgBox("oh, oh")
        End Try
    End Sub
End Class

É melhor trabalhares com o assíncrono para não empanares a aplicação.

Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.