The transport layer responsible for establishing a temporary communication session between two applications and delivering data between them
- Manages end-to-end connections between hosts through sockets
- Segments data for manageability and reassembles segmented data at the destination (splitting data into packets and back into data)
- It manages data integrity, error correction and delivery guarantee (TCP)
UDP
- User Datagram Packet is the basic transport layer protocol, providing an unreliable datagram service
- Online gaming and live video can use it as lost data is OK. Even VPN can use UDP as the tunnelling protocol takes care of lost packets
TCP
-
Transmission Control Protocol provides flow-control, connection establishment, and reliable transmission of data
- Anything where all transmitted data must be received uses TCP, but there’s a processing overhead for using it and it can be slow
-
TCP vs UDP
-
Think of TCP and UDP as using Royal Mail
-
If you are sending money, you will use recorded delivery and would only consider sending more money, once you have acknowledged that the first batch arrived safely
- This is TCP. It will only send more packets, once receipt has been acknowledged. If not, it will resend.
-
If you are just sending a standard letter, you put it in the post and hope it gets there. You would not receive an acknowledgement
- UDP tries but doesn’t care if it fails. Packets are sent without worrying if previous ones got there OK.
- It is deliberately light-weight and fast
-
TCP’s job is to establish a connection to the remote device before any data is sent
- It is therefore a connection oriented protocol
- Once a connection is established, data can flow in both directions (bidirectional)
- Packets are sent out and numbered (for resequencing once received) and it will wait for acknowledgement before sending more data
-
UDP’s job is to efficiently send out data without the overhead of TCP
- No connection is established before sending data
- UDP does not insert sequence numbers
- The packets are expected to arrive as a continuous stream, or they are dropped
-
Transport Layer Addressing
- While the Internet Layer uses IP Addressing, the Transport Layer uses ports
- The term socket is the combination of IP Address (Extended) and port #
Ports
- A port is a way to address specific application and have a source and destination port address. Each address is 16 bits.
- It works like an IP Address (Extended), but for applicaiton protocols rather than machines. A bit like having individual names on letter to the same house
- There are well known port numbers such as SMTP using port 25, HTTP using port 80, etc.
- However, these can be changed in software