TCP is a reliable form of communication that facilitates three-way handshakes that and a teardown process ensures the connection is reliable and interactive.
A TCP header is 20 bytes long and consists of various fields such as source and destination port, SEQ and ACK numbers, offset, window size, flag bits, checksum,
and options.
The SEQ and ACK numbers are used by TCP-based communications to keep track of data sent across.
A UDP is a connectionless protocol that is a nonreliable means of communication over IP, where the lost and discarded packets are never recovered. A UDP does provide
faster transmission and easier creation of sessions.
A UDP header is 8 bytes long and has very few fields, such as source and destination port, packet length, and checksum. Common protocols such as DHCP, TFTP, DNS, and RTP mostly use a UDP as a transport mechanism.