example

command
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

README

Go Module

Use tcplatency as a library

"github.com/cbrgm/tcplatency/latency"

Example (see main.go):

package main

import (
	"fmt"
	"github.com/cbrgm/tcplatency/latency"
)

func main() {
	var host = "google"
	var port = 443
	var timeout = 5
	var runs = 5
	var wait = 1

	result := latency.Measure(host, port, timeout, runs, wait)
	printSummary(host, result)

}

func printSummary(host string, result latency.MeasurementResult) {
	fmt.Printf("--- %s tcplatency statistics --- \n", host)
	fmt.Printf("%d packets transmitted, %d successful, %d failed  \n", result.Count, result.Successful, result.Failed)
	fmt.Printf("min/avg/max/mdev = %.2f/%.2f/%.2f/%.2f ms \n", result.Min, result.Average, result.Max, result.StdDev)
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL