The UDP layer can be regarded as being extremely thin and consequently has low overheads, but it requires the application to take responsibility for error recovery and so on. The port concept was discussed earlier in Ports and Sockets . Applications sending datagrams to a host need to identify a target which is more specific than the IP address, since datagrams are normally directed to certain processes and not to the system as a whole. UDP provides this by using ports . A port is a 16-bit number which identifies which process on a host is associated with a datagram.
Most servers require only a single port.
The reason for well-known ports is to allow clients to be able to find servers without configuration information. Each client process is allocated a port number as long as it needs it by the host it is running on. Ephemeral port numbers have values greater than 1023, normally in the range 1024 to 5000. These ports are quite independent. Normally, a server will use either TCP or UDP, but there are exceptions.