Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there's not output when ip unreachable #41

Open
shyandsy opened this issue Dec 11, 2019 · 0 comments
Open

there's not output when ip unreachable #41

shyandsy opened this issue Dec 11, 2019 · 0 comments

Comments

@shyandsy
Copy link

shyandsy commented Dec 11, 2019

How can i know that server is unreachable?

        p := fastping.NewPinger()
        ra, err := net.ResolveIPAddr("ip4:icmp", "111.111.111.1")
        if err != nil {
                panic(err)
        }
        p.AddIPAddr(ra)
        p.OnRecv = func(addr *net.IPAddr, rtt time.Duration) {
                fmt.Printf("IP Addr: %s receive, RTT: %v\n", addr.String(), rtt)
        }
        p.OnIdle = func() {
                fmt.Println("finish")
        }
        err = p.Run()
        if err != nil {
                fmt.Println(err)
        }

output

finish

in cmd

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant