connection oriented vs connectionless service
When we talk about the service of a layer to another layer, there are two kinds of services regarding connection a layer provides to another.

  • Connection-oriented service and,
  • Connectionless service

Connection-oriented service

Connection-oriented service works more like a telephone system in where we pick up the phone, make a call, talk, and then hang up the phone. Similarly, there is a dedicated line between the sender and the receiver on a network when it comes to connection-oriented service.

Connection-oriented service works more like a virtual tube in which the sender sends the data and they arrive in the order they were pushed by the sender to the receiver. We have already seen that how much QoS is important in the computer networks. During connection-oriented setup, for QoS purpose, a lot of negotiations can also happen at the beginning such as data delivery rate as we have already in the ATM networks, message size, etc.

There can also be different variants of connection-oriented services based on their functionalities at the layer two. For example,

Store and forward switching

In store and forward switching, an intermediate node stores the entire message before forwarding it to the next node. Its advantage is that when a packet gets lost, instead of actual receiver asking for retransmission, the intermediate node does the retransmission work. Also, the retransmission time is reduced and saved by a great deal.

Byte streaming

In byte streaming, packets are sent in any sequence. The order in which the packets are sent is not so important. For example – when we are downloading a movie from the internet, the byte sequence is not so important but the whole film.

Based on the acknowledgment also, we can summarize the type of services that a connection-oriented service offers:

Acknowledged datagram

An acknowledgment is also sent for each packet transmitted to the receiver. If the acknowledgment is not received for a particular set of packets, the receiver waits for some time before asking for the retransmission.

Request-reply service

Request-reply service is an improvement to the ACK datagram. In this service, an ACK is not sent by the receiver for every packet received rather the data is retransmitted on request by the receiver. That’s why its called request-reply service.

Connectionless service

Connectionless service is opposite to connection-oriented service. If connection-oriented service is analogous to the telephone system, then connectionless service is analogous to the postal services.

In connectionless service, there is no initial setup of the connection between the sender and the receiver for the data transfer. That means it cannot guarantee the delivery and QoS of the packets. Thus, the connectionless service becomes synonymous with unreliable service.

Cut through Switching

Unlike store and forward switching, in cut-through switching, the intermediate node does not store any packet rather it keeps on forwarding the packets in the order they are received.

Let us say the connection between the two nodes is connectionless. That means there has not been any negotiation about the predefined path between the source and the destination. In that case, the packets take the random path to reach the destination.

Now, there is no node in between in the cut through switching which will make sure that all the packets have arrived in order and then only it will forward to the next node as we have already seen in the store and forward switching.

So, it might also happen that N+1st arrives at any intermediate node before the Nth packet because all the packets are taking an independent path.

A common question is also often asked that why would one need an unreliable service at first hand itself? If we look at the OSI layer, we can realize that when the internet came into existence, the whole of the internet was built on the unreliable communication only. Later, when QoS and other things were introduced to the internet, connection-oriented services were needed.

Contrast to the real world scenario

If we look at the OSI layer, initially, guaranteed data delivery used to be implemented at the lower layers such as data link layer and network layer. That is so because, in PSTN (Public Switched Telephone Network), the data reliability was very less because of the poor-quality telephone connections.

If we look at the current scenario, networks have become more reliable due to newer technologies. So, the first three underlying layers are now made to focus more on the data speed and delivery rate. With time, the reliability and acknowledgment were pushed up to the upper layers such as transport layer.

For Example, LANs at the Data Link Layer work as connectionless systems. The moment you connect your PC to a network (wired or wireless), it will start transmitting frames as soon as it has access to the network. No setup is needed like TCP which works at the transport layer.

TCP (Transmission Control Protocol) is a connection-oriented transport protocol, on the other hand, UDP (User Datagram Protocol), which also works at the transport layer, is a connectionless network protocol. Both operate over IP.

Situations when UDP is preferred over TCP

  • SNMP (Simple Network Management Protocol)
  • DNS (Domain Name System)
  • Internet Radio
  • LAN requests
  • Router updates exchanges etc.

Difference between connection-oriented and connectionless service

  • A prior connection setup is needed in connection-oriented service but not in connectionless service.
  • Connection-oriented service guarantees reliability but not connectionless service.
  • Congestion is very unlikely in connection-oriented service but not in connectionless.
  • Lost data retransmission is possible in connection-oriented service but not in connectionless service.
  • Connection-oriented is suitable for long connection while connectionless is suitable for a bursty connection
  • Packets reach the destination following the same route in connection-oriented service, but for connectionless, the packets can take different paths.
  • Resource allocation is needed in the connection-oriented but not in the case of connectionless service.
  • The transfer is slower in the connection-oriented due to connection setup time and ACK but is faster in connectionless service due to missing initial setup and ACK.

If you are more interested in the similar topics, here is our coverage on computer networks.