Switching is the important mechanism that provides communication between different endpoints or different computers and manages the data flow between the two end points. There are three types of switching techniques –
- Circuit switching
- Packet switching
- Message switching
In this post we will discuss Packet switching.
Packet switching is a switching method in which data is transferred in the form of small broken pieces of variable lengths. These broken pieces of data are called as packets. The data is transferred in the form of packets, transmitted to the network line and reassembled at the destination making a complete file.
Thus, Packet Switching method uses Store and Forward technique. Each hop will store the packet and then forward the packets to the next host destination.
Types of Packet Switching
There are two types of packet switching :
- Virtual Circuit Packet Switching
- Datagram Packet Switching
VC Packet Switching:
VC Packet Switching is an approach in which a logical path or virtual circuit connection is done between sender and receiver. VC stands for Virtual Circuit. Thus, a predefined route is created and all packets will follow these predefined paths. In this logical connection, all routers or switches are provided with a unique Virtual Circuit ID to uniquely identify the virtual connections. It also has the same three-phase protocol used in circuit switching – Setup Phase, Data Transfer Phase and Tear down Phase. WAN, ATM, frame relay and telephone networks use virtual circuit approach.
In this diagram, four users connected with a four-switch network are showing data flow in Virtual circuit mode. The four switches are connected with each other and share the communications path with each other. To transfer data from USER A to the USER D, a predefined route is established, that passes from USER A to S1 to S2 to S3 and then finally to USER D. In this predefined route S1, S2, S3 are provided with a unique Virtual Circuit ID to identify the virtual connection, so the data is bound by the predefined path and could not choose another route.
Datagram Packet Switching:
In Datagram packet switching each packet has all the necessary information like Source address, destination address etc. So each packet is treated independently. They can choose different routes for transmitting data inside the network. There is no predefined route. So, the packets can be received in any sequence at the destination. Packets in this approach are called datagrams. Datagram approach can cause the datagrams to reach the destination out of order. Additional end system protocols need to be configured, to secure guaranteed packet receiving. This mode of packet switching, doesn’t involve setup, transfer and teardown phase.
In this diagram, again four users are connected with a switch- network , and data is transferred from USER A to USER D. The data contains two packets (or datagrams) – a and b. In Datagram Packet Switching, PACKET a & PACKET b choose different paths to reach the final destination i.e. USER D.
PACKET a :
USER A – S1 – S4 – S3 – USER D
PACKET b :
USER A – S1- S5 – S3 – USER D
The different paths can be chosen depending on the delay time and congestion on other paths.