Difference between Connection-oriented and Connection-less Services

In this tutorial, you will learn the basics of computer networking, including its definition, advantages, applications, and working. Additionally, you will explore the differences between connection-oriented and connection-less services. In short, you will understand how computer networks work, why they are useful nowadays, and the distinctions between connection-oriented and connection-less services.

Contents:

  1. Services Provided to the Transport Layer
  2. Connectionless (CL) Service
  3. Implementation of Connectionless Service
  4. Connection-Oriented (CO) Service
  5. Implementation of Connection-Oriented Service
  6. Issues of Connectionless and Connection-Oriented Service
  7. Resource Utilization in CL and CO Service
  8. Connectionless vs Connection-Oriented Service

Services Provided to the Transport Layer

The network layer communicates with the transport layer. It provides services to deliver packets to the transport layer. Without the services of the network layer, packets cannot reach the transport layer from the network layer. Here, the question is, what kind of services does the network layer provide to the transport layer.

  • The services provided to the transport layer must be carefully designed.
  • For better communication with the transport layer, services must be independent of router technology.
  • The network layer provides a connectionless and connection-oriented service to the transport layer for communication.

Connectionless Service

The network layer provides two types of service to its users. We will see how it works inside the network layer. In a connectionless service, packets sent by the sender are individually injected into the network that travels through different routes. There is no need for an advanced path setup in a connectionless service to transmit the packets.

  • In connectionless service, packets are called datagrams, and the network used to transmit packets is known as datagram networks.
  • Connectionless service is an unreliable service. When two devices want to communicate with each other, a predetermined path is not required.
  • IP protocol at the network layer and UDP protocol at the transport layer uses connectionless service. Since they are using connectionless services, there is no guarantee of successful packet delivery.

advertisement
advertisement

Implementation of Connectionless Service

Let us now see how a connectionless service or datagram network works in the network layer.

The diagram below explains the implementation of a connectionless service.

Implementation of Datagram Network
  • As shown in the figure, PC-1 and PC-2 wants to communicate. PC-1 needs to send the packets to PC-2. Process-1 and Process-2 are running on PC-1 and PC-2, respectively.
  • The network layer communicates with the transport layer and sends the message with instructions to deliver packets to the PC-2 process.
  • The network layer breaks the packet into four packets, packet-1, packet-2, packet-3, and packet-4.
  • All four packets are transmitted to Router-1 using the point-to-point protocol. Router-1 has an initial router table that decides where to send the packets.
  • Each router has two columns, Destination, and Line. Using the line column, the router determines the path to reach the other router. But, it uses only directly connected lines.
  • For example, Router-1 has two outgoing lines Router-2 and Router-3. So Router-1 will send each packet to Router-2 and Router-3.
  • Packet-1, Packet-2 and Packet-3 are transmitted through the path Router-1 -> Router-3 -> Router-5 -> Router-6 -> PC-2, while Packet-4 is transmitted though the path Router-1 -> Router-2 -> Router-4 -> Router-5 -> Router-6 -> PC-2.
  • But why is packet-4 traveling on a different path than the path of the first three packets? Because Router-1 understood the network and detected a traffic jam somewhere along the 1-3-5-6-PC2 way.
  • The routing algorithm is used to manage and make routing decisions based on a routing table.

Connection-Oriented Service

In connection-oriented service, a predetermined path for communication is established before communication takes place between devices. The path established between sender and receiver is known as a virtual circuit, and the network used to transmit packets is known as a virtual-circuit network.

  • Virtual-circuit networks are used in a connection-oriented service. Using a virtual-circuit router prevents packets from being sent on another path instead of the prescribed one.
  • When a connection is established between two devices, the route information is stored in the routing table.
  • The chosen route is used for sending all packets and all traffic flowing over the connection. For example, the telephone system uses a connection-oriented service.
  • In a connection-oriented service, each packet has an identifier used to describe which virtual circuit it belongs to.
  • Multiprotocol Label Switching (MPLS) uses a connection-oriented service. IP packets are wrapped in an MPLS header that contains a 20-bit connection identifier, which is used to identify the path to send the packet.

Implementation of Connection-Oriented Service

Let’s understand the implementation of connection-oriented service at the network layer.

The diagram below explains the implementation of a connection-oriented service.

Implementation of Virtual Circuit Network
  • As shown in the figure, the connection is established before the communication between PC-1 and PC-2.
  • PC-1 is sending four packets to PC-2. Here, the identifier -1 is assigned to the packets of PC-1. Packet-1, Packet-2, Packet-3 and Packet-4 are transmitted to PC-2 with the identifier -1.
  • Now, PC-3 also wants to send a packet to PC-2. It asks for identifier-1 from the network layer to establish a virtual-circuit network. But it is already assigned to PC-2. The router-1 assigns identifier-2 to PC-3.
  • In the end, the routing table has two entries, one for PC-1 and the other for PC-3.
  • Different identifiers are used to avoid packet collisions on the network.

advertisement

There are several issues with connectionless and connection-oriented services within the network. They are as follows:

  • In virtual-circuit networks, the path has to be predetermined, which takes setup time and consumes resources. But once the path is established between the devices, it is easy to decide what to do with the packets.
  • The router uses the circuit number in the virtual-circuit network to find the destination to send the packet. This feature helps in figuring out what to do with the packets and where to send them.
  • Communication in a datagram network does not require a predetermined path. But this strategy requires a more complex lookup process for creating routing tables and sending packets.
  • Datagram networks do not use virtual-circuit networks. The router creates a destination address entry in the routing table instead of a virtual circuit. The destination address is longer than the circuit numbers used in a virtual circuit, this causes a significant amount of overhead, and hence, a waste of bandwidth.
  • The router must have enough memory to store the destination address in the datagram network. Routers must have every possible destination address entry that uses more memory, whereas, in virtual-circuit networks, routers require only one entry for each virtual circuit.

Resource Utilization in CL and CO Service

Let us discuss how virtual-circuit networks and datagram networks use the resources of the network and system.

  • In a virtual-circuit network, resources (buffers, bandwidth, and CPU) are reserved when a connection is established between devices.
  • Due to resource reservation in virtual-circuit networks, it guarantees the quality of service and avoids network congestion.
  • When a sender sends packets, the allocated bandwidth is used for faster transmission of packets over the network, avoids congestion.
  • In datagram networks, there are no reserved resources when packets are transmitted over a network. If multiple packets are transmitted on the same path, it leads to congestion due to a lack of bandwidth.
  • In a virtual circuit network, if a router crashes and the buffer is lost, all virtual circuits passing through it will have to be aborted, as it was the path for the packets which was already established.
  • In a datagram network, if a router crashes during transmission, only those packets that are queued in the router are affected.
  • Datagram networks allow routers to balance traffic across the network because the route can be changed by the router when there are many packets.

advertisement

Connectionless vs connection-oriented service

The table below shows the comparison between connectionless and connection-oriented services.

Key Connectionless Service Connection-Oriented Service
Path Setup Not needed Established in advance
Address Each packet has a complete source and destination address. Each packet contains a virtual circuit number.
Routing Decision A packet is routed independently. Packets follow the virtual circuit number.
Resources Reservation Not reserved Reserved before communication
Router Failure Affects only packets lost during transmission. Affects all VCs passing through it.
Congestion Control Difficult Easy
Quality of Service Difficult Easy
Network Datagram Network Virtual-Circuit Network
Protocols IP, UDP, etc. TCP, X.25, Frame Relay, etc.

Key Points to Remember

Here is the list of key points we need to remember about “Connectionless and Connection-Oriented Services”.

  • The network layer provides a connectionless and connection-oriented service to the transport layer for communication.
  • In a connectionless service, packets sent by the sender are individually injected into the network that travels through different routes. There is no need for an advanced path setup in a connectionless service to transmit the packets.
  • In connectionless service, packets are called datagrams, and the network used to transmit packets is known as datagram networks.
  • In connection-oriented service, a predetermined path for communication is established before communication takes place between devices.
  • The path established between sender and receiver is known as a virtual circuit, and the network used to transmit packets is known as a virtual-circuit network.
  • In a virtual-circuit network, resources (buffers, bandwidth, and CPU) are reserved when a connection is established between devices. In datagram networks, there are no reserved resources.
  • IP protocol at the network layer and UDP protocol at the transport layer uses connectionless service. TCP, X.25, and Frame Relay use the connection-oriented service.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.