Physically, a port is a 16-bit integer. Some ports are reserved for particular applications; they are labeled as well-known ports.
Integer is a numeric value, while String is a character value represented in quotes.
The port number 8080 is usually used for web servers, proxy and caching.
"Port Zero" does not officially exist. It is defined as an invalid port number. But valid Internet packets can be formed and sent "over the wire" to and from "port 0" just as with any other ports.
This is because what appears after the colon can be either a port number or service name.
The following is a valid example where the service name is used instead of a port number:
listener, err := net.Listen("tcp", "localhost:https") // port 443
// ...
The port mapping for a particular service can be looked up using net.LookupPort
. On Unix systems, the /etc/services
file is sourced for the mappings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With