func (this *Pinger) Start() (<-chan *PingResult, error) {
	if !atomic.CompareAndSwapInt64(&this.pid, 0, int64(os.Getpid()&0xffff)) {
		return nil, fmt.Errorf("ping/Start: Pinger already running")
	}

	switch runtime.GOOS {
	case "nacl", "plan9", "solaris", "windows":
		return nil, fmt.Errorf("ping/Start: Operation not supported on %q", runtime.GOOS)
	}

	if os.Getuid() != 0 {
		return nil, fmt.Errorf("ping/Start: User must be root")
	}

	this.updateParams()

	if len(this.payload) < this.Size {
		this.payload = make([]byte, this.Size)
	} else {
		this.payload = this.payload[:this.Size]
	}

	var err error

	this.pconn, err = net.ListenPacket("ip4:icmp", "0.0.0.0")
	if err != nil {
		return nil, err
	}

	this.rconn, err = ipv4.NewRawConn(this.pconn)
	if err != nil {
		return nil, err
	}

	cf := ipv4.FlagTTL | ipv4.FlagDst | ipv4.FlagInterface

	if err := this.rconn.SetControlMessage(cf, true); err != nil {
		//glog.Errorf("ping/sender: Error setting control message: %v", err)
		return nil, err
	}

	this.wg.Add(1)
	go this.receiver()

	this.wg.Add(1)
	go this.sender()

	return this.reschan, nil
}
// Start kicks off the pinging process. It takes the list of IP addresses added by
// AddIPs() and sends ICMP ECHO_REQUEST to all of them at the specified Interval.
// Results are sent via the returned channel. The caller is expected to read the
// channel so it won't get blocked.
//
// Only a single Start can be called at a time. If the second call to Start is made,
// and error will be returned.
Start kicks off the pinging process. It takes the list of IP addresses added by
AddIPs() and sends ICMP ECHO_REQUEST to all of them at the specified Interval.
Results are sent via the returned channel. The caller is expected to read the
channel so it won't get blocked.

Only a single Start can be called at a time. If the second call to Start is made,
and error will be returned.
// Start kicks off the pinging process . It takes the list of IP addresses added by // AddIPs () and sends ICMP ECHO_REQUEST to all of them at the specified Interval . // Results are sent via the returned channel . The caller is expected to read the // channel so it won ' t get blocked . // // Only a single Start can be called at a time . If the second call to Start is made // and error will be returned .
func (this *Pinger) Start() (<-chan *PingResult, error) {
	if !atomic.CompareAndSwapInt64(&this.pid, 0, int64(os.Getpid()&0xffff)) {
		return nil, fmt.Errorf("ping/Start: Pinger already running")
	}
	switch runtime.GOOS {
	case "nacl", "plan9", "solaris", "windows":
		return nil, fmt.Errorf("ping/Start: Operation not supported on %q", runtime.GOOS)
	}
	if os.Getuid() != 0 {
		return nil, fmt.Errorf("ping/Start: User must be root")
	}
	this.updateParams()
	if len(this.payload) < this.Size {
		this.payload = make([]byte, this.Size)
	} else {
		this.payload = this.payload[:this.Size]
	}
	var err error
	this.pconn, err = net.ListenPacket("ip4:icmp", "0.0.0.0")
	if err != nil {
		return nil, err
	}
	this.rconn, err = ipv4.NewRawConn(this.pconn)
	if err != nil {
		return nil, err
	}
	cf := ipv4.FlagTTL | ipv4.FlagDst | ipv4.FlagInterface
	if err := this.rconn.SetControlMessage(cf, true); err != nil {
		return nil, err
	}
	this.wg.Add(1)
	go this.receiver()
	this.wg.Add(1)
	go this.sender()
	return this.reschan, nil
}
func ( this * Pinger ) Start ( ) ( <- chan * PingResult , error ) { if ! atomic . CompareAndSwapInt64 ( & this . pid , 0 , int64 ( os . Getpid ( ) & 0xffff ) ) { return nil , fmt . Errorf ( " " ) } switch runtime . GOOS { case " " , " " , " " , " " : return nil , fmt . Errorf ( " " , runtime . GOOS ) } if os . Getuid ( ) != 0 { return nil , fmt . Errorf ( " " ) } this . updateParams ( ) if len ( this . payload ) < this . Size { this . payload = make ( [ ] byte , this . Size ) } else { this . payload = this . payload [ : this . Size ] } var err error this . pconn , err = net . ListenPacket ( " " , " " ) if err != nil { return nil , err } this . rconn , err = ipv4 . NewRawConn ( this . pconn ) if err != nil { return nil , err } cf := ipv4 . FlagTTL | ipv4 . FlagDst | ipv4 . FlagInterface if err := this . rconn . SetControlMessage ( cf , true ) ; err != nil { return nil , err } this . wg . Add ( 1 ) go this . receiver ( ) this . wg . Add ( 1 ) go this . sender ( ) return this . reschan , nil }
Start kicks off the pinging process.
Start kicks off the pinging process .
//glog.Errorf("ping/sender: Error setting control message: %v", err)