troubleshooting Question

ASP.NET: System.Net Ping Help!

Avatar of asp_net2
asp_net2Flag for United States of America asked on
Programming Languages-Other.NET ProgrammingASP.NET
18 Comments1 Solution713 ViewsLast Modified:
Hi,

I need help with finishing what i started below. I'm very new to this namespace and found a few tutorials online, but do not know how to handle if an hostname / IP is un pingable.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    End Sub

    Protected Sub PingUtility_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PingUtility.Click

        Try
            lblStatus.Text = ""
            Dim ping As Ping = New Ping()
            Dim pingreply As PingReply = ping.Send(txtHost.Text)
            txtPing.Text &= "Address: " & pingreply.Address.ToString() & Constants.vbCr
            txtPing.Text &= "Roundtrip Time: " & pingreply.RoundtripTime & Constants.vbCr
            txtPing.Text &= "TTL (Time To Live): " & pingreply.Options.Ttl & Constants.vbCr
            txtPing.Text &= "Buffer Size: " & pingreply.Buffer.Length.ToString() & Constants.vbCr

        Catch err As Exception

            lblStatus.Text = err.Message
        End Try
    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros