Measuring Network Latency

B

Brian Mac

i'm looking for ideas of measuring network latency with ruby. i can't
reliably use net::ping because rdp (remote desktop protocol) traffic
is being prioritized. i thought i could use Net::pingTCP and get the
duration but users in a remote office are complaining of network
latency when i'm just not seeing it from the code below (even when
using a high count).

here is the the code that i'm working with. any help or suggestions
would be much appreciated.


$endpoints = {"Office Name" => 'some.ip.address.here'}

def self.latency_summary(ping_count=50)
$endpoints.sort.each do |k,v|
sum = 0
results = Array.new
ping_count.times {
p = Net::pingTCP.new(v, 3389)
p.ping
results << p.duration
}

results.each do |num|
sum += num
end

puts "Avg/Max/Min response time to #{k} for #{ping_count.to_s} TCP
pings: #{(sum/results.length)}.sec / #{results.max}sec / #{results.min}
sec"
end
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top