I wrote a simple web server to listen on port 8080. But I don't want to use a hard coded port number. What I want is that my server listen on any available port. And I want to know that on what port number my web server is listening.
My code is given bellow:
package main import ( "net/http" ) func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }
1.4m articles
1.4m replys
5 comments
57.0k users