TCP corresponds to a connection-oriented, reliable, stream service. Application protocols are built on TCP when:
They need reliability.UDP corresponds to a connection-less, unreliable, datagram service. Application protocols are built on UDP when:
They are to operate in a complex network environment with long distances (many hops) between sender and receiver.
They can bear the overhead of connection establishment.
A retransmission scheme to insure reliability makes sense.Many app protocols use TCP: FTP, TELNET, SMTP, NNTP, etc.
They don't care about reliability.
They are intended for a limited, high speed, controlled, small environment (like a LAN).
They send very little data and would suffer with the overhead of connection establishment.
They can use retransmission to replace missing pieces. Synchronous apps like audio and video cannot in general.Fewer app protocols use UDP: DNS, NFS, SNMP
Well-known ports are services that have agreed upon port numbers. Reserved ports are 1-255, or 1-1023.
Port numbers are 16 bit quantities, so the largest port number is 65,535.