Many Internet services are identified using a standard port number, the so-called well-known port numbers. For example, remote logins with TELNET are established using port 23. Mail delivery uses port 25. File transfers are done with ports 20 and 21. Any TCP connection request targeted at one of these well-known port numbers is understood to be for a particular service. For example, establishing a TELNET session to a remote host only requires a hostname lookup to find the remote IP address, then a connection to that host's port 23.
On UNIX systems, a program called Inetd maintains passive sockets on a variety of these well-known ports. When a new connection is created, Inetd starts a program to handle the connection, based upon a configuration table. This way, one program can handle incoming connections for a variety of services. Inetd only runs server programs as they are needed, and will spawn multiple server programs to service multiple network connections. Inetd works best for network services with fairly long duration, so the extra startup overhead becomes negligible.