Sorry I did not express myself well.I would be interested in any illustration of how to send and/or receive ICMP packets, any examples.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thank you. I have looked at this : https://github.com/tatsushid/go-fastping/blob/master/cmd/ping/ping.goBut it just makes no sense for me. I am beginning in Golang and I am not able to make this mysterious example work. There is only one illustration on the github, but would you have another I could understand better ?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
With this code :
http://play.golang.org/p/L479GHuszc
I get this error when I call "go run main.go"
panic: listen ip4:icmp <nil>: operation not permitted
goroutine 1 [running]:
runtime.panic(0x52e160, 0xc21004f940)
/usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6
main.main()
/home/user/Golang/src/test/main.go:25 +0x152
exit status 2
I get this error when I call "sudo go run main.go"
main.go:8:2: cannot find package "github.com/tatsushid/go-fastping" in any of:
/usr/lib/go/src/pkg/github.com/tatsushid/go-fastping (from $GOROOT)
($GOPATH not set)
(my GOPATH is set, and even if I do "export GOPATH=~/Golang" 20 times I will still get the same error)
--
--
user@user:~/Golang/src/deviceDiscoveryV2$ go clean main.go
user@user:~/Golang/src/deviceDiscoveryV2$ go build main.go
user@user:~/Golang/src/deviceDiscoveryV2$ go install main.go
go install: no install location for .go files listed on command line (GOBIN not set)
user@user:~/Golang/src/deviceDiscoveryV2$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/Golang/"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"
user@user:~/Golang/src/deviceDiscoveryV2$ export GOBIN=~/Golang/bin/
user@user:~/Golang/src/deviceDiscoveryV2$ go install main.go
user@user:~/Golang/src/deviceDiscoveryV2$ sudo main
--
func main() {
pinger := fastping.NewPinger()
for i:=0; i<10; i++ {
addr, err := net.ResolveIPAddr("ip", "10.11.204.50")
if err != nil {
panic("Error resolving IP Address: " + err.Error())
}
pinger.AddIPAddr(addr)
}
pinger.OnRecv = func(addr *net.IPAddr, rtt time.Duration) {
fmt.Printf("%s time=%v seconds\n", addr, rtt.Seconds())
}
if err = pinger.Run(); err != nil {
panic(err)
}
}
func main() {
pinger := fastping.NewPinger()
addr, err := net.ResolveIPAddr("ip", "10.11.204.50")
if err != nil {
panic("Error resolving IP Address: " + err.Error())
}
pinger.AddIPAddr(addr)
pinger.OnRecv = func(addr *net.IPAddr, rtt time.Duration) {
fmt.Printf("%s time=%v seconds\n", addr, rtt.Seconds())
}
if err = pinger.Run(); err != nil {
panic(err)
}
}
This changes nothing :/Fast ping function still returns empty slices
--
user@user:~/Golang/src/test$ go build
user@user:~/Golang/src/test$ go install
user@user:~/Golang/src/test$ sudo $GOPATH/bin/test
TEST : 10.11.204.50 time=0.050004808000000005 seconds
user@user:~/Golang/src/test$
user@user:~/Golang/src/test$ go build
user@user:~/Golang/src/test$ go install
user@user:~/Golang/src/test$ sudo $GOPATH/bin/test