https://en.wikipedia.org/wiki/Virtual_hosting says
Name-based virtual hosts use multiple host names for the same IP address.
Does a "host name" correspond to an IP address or a pair of IP address and a port?
When specifying a "host name", do we still need to specify a port?
If that matters, consider only in virtual hosting.
Thanks.
Host names do not correspond to an {ipaddress,port} tuple. A host name is only the name of a server, which should be resolvable to one or more IP addresses. Ports have nothing to do with host names at all.
A "virtual host" is simply a feature of a piece of software which takes advantage of extra context in a request to act differently.
An important thing to note is that TCP/IP itself does not know anything about host names; their main purpose is as a way to find IP addresses.
The classic example is an HTTP Server using name-based virtual hosting, which works like this:
Host names are handled by DNS (or other name resolution like a hostfile). Webservers listen on IPs/Sockets, but when running virtual hosts they also look at the request header for what FQDN was used to request the page.
When a web server running virtual hosts responds to a request, it looks at the request header to see if the request is from a host it knows about, then serves up the correct page. i.e. if i have a server with virtual host for initech.xyz, DNS will point it to the IP of my web server, which is listening on the default http/s ports (80/443). Based on the configuration you can turn on/off different ports that each virtual host responds to, but from an IP/port perspective, if the port is enabled, it's open.
Also DNS can have multiple IPs resolving to the same name, and vice versa.