Files
bl/common/utils/tcpping.go

18 lines
246 B
Go
Raw Normal View History

package utils
import (
"net"
"time"
)
func TcpPing(address string) (n int64, err error) {
s := time.Now()
tcpConn, err := net.Dial("tcp", address)
n = time.Now().Sub(s).Nanoseconds()
if err != nil {
return
}
tcpConn.Close()
return
}