Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does port ":http" mean in http.Server?

Tags:

go

I was reading the type declaration for http.Server in the documentation and I came across this.

type Server struct {
    Addr string // TCP address to listen on, ":http" if empty
    // more...
}

If you call srv.ListenAndServe() and srv.Addr is an empty string, then ListenAndServe will pass ":http" to net.Listen (http/server.go).

What does ":http" mean?

like image 860
425nesp Avatar asked Jul 22 '15 06:07

425nesp


People also ask

What port does HTTP server use?

Most browsers make HTTP requests on ports 80 and 443 by default. Typically, the default configuration option is for servers to listen on all IP addresses on port 80.

What does HTTP port 80 mean?

On a Web server or Hypertext Transfer Protocol daemon, port 80 is the port that the server "listens to" or expects to receive from a Web client, assuming that the default was taken when the server was configured or set up. A port can be specified in the range from 0-65536 on the NCSA server.

Is port 8080 HTTP or HTTPS?

You cannot use the same port for both http and https. Unlike some other types of servers, webservers do not negotiate encryption. If it's encrypted (https), it must be sent to 443/8443. If it's plain text (http) it must be sent to 80/8080.


1 Answers

Sometimes ports have aliases. http is 80.You can see more names here: http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml

like image 193
ReyCharles Avatar answered Sep 19 '22 13:09

ReyCharles