You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
722 B
35 lines
722 B
package goping
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/signal"
|
|
"testing"
|
|
)
|
|
|
|
func TestSign(tt *testing.T) {
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, os.Interrupt, os.Kill)
|
|
|
|
s := <-c
|
|
fmt.Println("Got signal:", s)
|
|
}
|
|
func TestPing(tt *testing.T) {
|
|
//if len(os.Args) < 3 {
|
|
// fmt.Printf("Param domain |data package Sizeof|trace times\n Ex: ./Ping www.so.com 100 4\n")
|
|
// os.Exit(1)
|
|
//}
|
|
//PS, err := strconv.Atoi(os.Args[2])
|
|
//if err != nil {
|
|
// fmt.Println("you need input correct PackageSizeof(complete int)")
|
|
// os.Exit(1)
|
|
//}
|
|
//Count, err := strconv.Atoi(os.Args[3])
|
|
//if err != nil {
|
|
// fmt.Println("you need input correct Counts")
|
|
// os.Exit(1)
|
|
//}
|
|
Ping("www.baidu.com", 48)
|
|
//Ping("www.baidu.com", 48, 5)
|
|
}
|