MCPcopy Create free account
hub / github.com/screego/server / port

Function port

server/server_test.go:96–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94}
95
96func port() int {
97 addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
98 if err != nil {
99 panic(err)
100 }
101
102 l, err := net.ListenTCP("tcp", addr)
103 if err != nil {
104 panic(err)
105 }
106 defer l.Close()
107 return l.Addr().(*net.TCPAddr).Port
108}

Callers 2

TestShutdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected