How can I Improve ping parameters to get consistent response vb.net -


i'm having issue inconsistent response on of ip's on network. getting success or failure randomly every time ping if ping windows command line successful every time... code i'm using ping follows:

    dim myping ping = new ping     dim pingreply pingreply     dim host string = "x.x.x.x"     dim timeout = 1000     dim packetsize = 32     dim data string = ""     dim integer      = 1 packetsize         data = string.concat(data, "a")     next      dim buffer() byte = encoding.ascii.getbytes(data)      try         pingreply = myping.send(host, timeout, buffer)          if pingreply.status = ipstatus.success             msgbox("success")         else             msgbox("failure")         end if      catch ex exception     end try 

it might useful know accessing network through vpn doesn't explain why command line ping successful.

is there way can adjust parameters consistent response? i'd avoid slowing down pinging time there many ip's ping.

any or advice appreciated! thanks

bewere windows' ping.exe gives 5 seconds timeout, yeah, may suceed yours fail if latency high though thats not case. also, ommiting pingoptions parameter might carry important information ping packet behaviour.

try again with:

dim options pingoptions = new pingoptions options.dontfragment = true  (...)  pingreply = myping.send(host, timeout, buffer, options) 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -