Quote from Data and Computer Communication Book by William Stallings
Two (2) types of switching technique :
1. Datagram Approach
Each packet is treated independently, with no reference to packets that have gone before. Let us consider the implication of this approach. Suppose that station A has a three-packet message to send to E. It transmits the packet, 1-2-3, to node 4. Node 4 could possibly forward this packet to either node 5 or node 7 as the next step in the route. In this case, node 4 determines that is queue for node 7 is now shorter and so queues packet 3 for that node. So the packets, each with the same destination address, do not all follow the same route. As a result, it is possible that packet 3 will beat packet 2 to node 6. Thus, it is also possible that the packet will be delivered to E in a different sequence from the one in which they were sent. It is up to E to figure out how to reorder them. Also it is possible that packets to be destroyed in the network. From example, if a packet switching node crashes momentarilly, all of its queued packets may be lost. If this were to happen to one of the packets in our example, node 6 has no way of knowing that one of the packets in the sequence of packets has been lost. Again, it is up to E to detect the loss of the packet and figure out how to recover it
2. Virtual Circuit Approach
A preplaned route is established before any packets are sent. For example, suppose that A has one or more messages to sent to E. It first sends a special control packet, referred to as a Call-Request packet, to 4, requesting a logical connection to E.
Node 4 decides to route the request and all subsequent packets to 5, which decides to route the request and all subsequent packets to 6, which finally delivers the Call-Request packet to E. If E is prepared to accept the connection, it sends a Call-Request packet to 6. This packet is passed back through nodes 5 and 4 to A. Stations A and E may now exchange data over the route that has been established. Because the route is fixed for the duration of the logical connection, it is somewhat similar to a circuit-switching network, and is referred to as a virtual circuit. Each packet now contains a virtual-circuit identifier as well as data. Each node on the preestablished route knows where to direct such packets; no routing decisions are required. Thus every data packet from A intended for E traverses nodes 4,5 and 6; every data packet from E intended for A traverses nodes 6,5 and 4. Eventually, one of the stations terminates the connection with a Clear-Request packet. At any time, each station can have more than one virtual circuit to any other station and can have virtual circuits to more than one station.
So the main characteristic of the virtual circuit technique is that route between stations is set up prior to data transfer. Note that this does not mean that this is a dedicated path, as in circuit swithing. A packet is still buffered at each node, and queued for output over a line.
The difference from the datagram approach is that, with virtual circuits, the node not make a routing decision for each packet; it is made only once for all packets using that virtual circuit
Advantage of Datagram Approach :
- The call setup phase is avoided. Thus if a station wishes to send only one or a few packets, datagram delivery will be quicker
- Because it’s more primitive, it is more flexible. For example, it congestion develops in one part of the network, incoming datagram can be routed away from the congestion. With the use of virtual circuits ,packets follow a predefined route, and it is thus more difficult for the network to adapt to congestion.
- Delivery is inherently more reliable, with the use of virtual circuits, if a node fails, all virtual circuits that pass through that node are lost. With datagram delivery, if a node fails, subsequent packets may find an alternate route that bypassess that node.