// GetFreeAddress asks the kernel for a free open port that is ready to use
GetFreeAddress asks the kernel for a free open port that is ready to use
// GetFreeAddress asks the kernel for a free open port that is ready to use
func GetFreeAddress() (string, error) {
	addr, err := net.ResolveTCPAddr("tcp", localhost+"0")
	if err != nil {
		return "", err
	}
	l, err := net.ListenTCP("tcp", addr)
	if err != nil {
		return "", err
	}
	defer l.Close()
	return localhost + strconv.Itoa(l.Addr().(*net.TCPAddr).Port), nil
}
func GetFreeAddress ( ) ( string , error ) { addr , err := net . ResolveTCPAddr ( " " , localhost + " " ) if err != nil { return " " , err } l , err := net . ListenTCP ( " " , addr ) if err != nil { return " " , err } defer l . Close ( ) return localhost + strconv . Itoa ( l . Addr ( ) . ( * net . TCPAddr ) . Port ) , nil }
GetFreeAddress asks the kernel for a free open port that is ready to use
GetFreeAddress asks the kernel for a free open port that is ready to use