master
sre 4 years ago
parent 9c972120ef
commit 6c76bc7e07

@ -5,14 +5,22 @@ import (
"os"
"os/signal"
"testing"
"time"
)
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)
for {
select {
case s := <-c:
signal.Notify(c, os.Interrupt, os.Kill)
fmt.Println("Got signal:", s)
os.Exit(0)
default:
fmt.Println("okok")
time.Sleep(time.Second * 1)
}
}
}
func TestPing(tt *testing.T) {
//if len(os.Args) < 3 {

@ -22,11 +22,12 @@ pong www.baidu.com 443 -t 1 -k udp
pong -a www.baidu.com -p 443 -k tcp -t 3
`
func main2() {
func main() {
c := make(chan os.Signal, 1)
for {
select {
case s := <-c:
fmt.Println("ctc")
signal.Notify(c, os.Interrupt, os.Kill)
fmt.Println("Got signal:", s)
os.Exit(0)
@ -37,7 +38,7 @@ func main2() {
}
}
func main() {
func main3() {
address := flag.String("a", "", "domain or ip address")
port := flag.Int("p", 0, "port")
protocol := flag.String("k", "tcp", "protocol kind")

Loading…
Cancel
Save