Connection-Oriented Service
A connection-oriented service establishes a connection between the sender and receiver before transferring data.
It generally ensures reliable and ordered delivery.
Example: TCP (Transmission Control Protocol).
How does it work?
Connection establishment – Sender and receiver establish a connection.
Data transfer – Data is transmitted between them.
Connection termination – The connection is closed after communication.
TCP uses a process called the Three-Way Handshake to establish a connection.
Step 1 - SYN (Client → Server): The client requests a connection and sends its initial sequence number.
Step 2 - SYN-ACK (Server → Client): The server acknowledges the client's request and sends its own sequence number.
Step 3 - ACK (Client → Server): The client acknowledges the server's sequence number.
Characteristics:
Reliable data transmission.
Acknowledgment of received data.
Maintains data order.
Error detection and retransmission.
SYN - Synchronize
SYN-ACK - Synchronize + Acknowledgment
Connectionless Service
A connectionless service sends data directly without establishing a connection between the sender and receiver.
Each packet is transmitted independently.
Example: UDP (User Datagram Protocol).
How does it work?
Sender prepares the data.
Data is sent directly to the destination.
Receiver receives packets independently, if they arrive.
There is no connection establishment or termination process.
Characteristics:
No connection establishment required.
Faster with less overhead.
No guaranteed delivery.
No guaranteed packet ordering.
No built-in retransmission.
Each packet is handled independently.