3 Replies - 610 Views - Last Post: 26 August 2016 - 02:10 AM Rate Topic: -----

#1 AlexA1   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 9
  • Joined: 05-March 16

Ping with Request time out problem

Posted 26 August 2016 - 01:28 AM

Hi all

I have this code:

 Imports System.ComponentModel
Imports System.Net
Imports System.Net.NetworkInformation
Imports System.Threading
Public Class Form1
    Dim ping As New Ping
    Dim rp(2) As PingReply

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        BackgroundWorker1.RunWorkerAsync()
    End Sub

    Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        rp(0) = ping.Send("www.google.com")
        rp(1) = ping.Send("89.121.174.55") 'Request time out
        rp(2) = ping.Send("yahoo.com") 'OK
        

    End Sub

    Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
        Label1.Text = "google :" & rp(0).RoundtripTime & " ms"
        Label2.Text = "An IP:" & rp(1).RoundtripTime & " ms"
        Label3.Text = "yahoo:" & rp(2).RoundtripTime & " ms"
        

        BackgroundWorker1.RunWorkerAsync()
    End Sub
End Class





If the IP 188.27.235.25 gives Request time out ,the program is not working

What am I missing?

Is This A Good Question/Topic? 0
  • +

Replies To: Ping with Request time out problem

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6823
  • View blog
  • Posts: 28,274
  • Joined: 12-December 12

Re: Ping with Request time out problem

Posted 26 August 2016 - 02:01 AM

In what way is it not working? Is there an Exception?
Was This Post Helpful? 0
  • +
  • -

#3 AlexA1   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 9
  • Joined: 05-March 16

Re: Ping with Request time out problem

Posted 26 August 2016 - 02:09 AM

"Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped"

I have attached the resault.

It gives no error , jut not working , strange.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6823
  • View blog
  • Posts: 28,274
  • Joined: 12-December 12

Re: Ping with Request time out problem

Posted 26 August 2016 - 02:10 AM

You could try playing with the timeout, ping.Send("89.121.174.55", 50000). However, the whole purpose of a ping is to see whether you get a response, and within a reasonable time frame. You can check the Status property for TimedOut.

Ping.Send Method

"It gives no error , jut not working , strange. "

Again, what does "not working" mean? What happens, or doesn't happen?

[Does the screen explode? Does purple confetti start falling from the sky? Does a hole appear in the space-time continuum?..]
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1